> This page is for version Preview (default).
> For other versions, use one of these documentation indexes:
> - Preview (default): https://docs.preview.paid.ai/preview/llms.txt
> - Current: https://docs.preview.paid.ai/current/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.preview.paid.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.preview.paid.ai/_mcp/server.

# Search invoices

POST https://api.paid.ai/v1/invoices/search
Content-Type: application/json

Finds invoices by conditions on their fields, including the billed customer's current `name` and `email`, a comparison on `amounts.total` or `amounts.remaining`, and `or` groups, and returns them as the list does: a page, newest first. Every entry of `filters` must hold. A customer-scoped key finds only its own customer's invoices, whatever the filters say. A read, sent as a POST because the conditions are a structured body: it creates nothing and is safe to retry. Use `invoices.list` when a list filter is all you need.

Reference: https://docs.preview.paid.ai/api-reference/billing/invoices/search

## Authentication

- `Authorization` header (bearer token, required) — API Key authentication using Bearer token

## Request

### Headers

- `Paid-Beta` (enum, required) — This endpoint is in the `search=v1` beta. Send this header to use it.
  - Allowed values: `search=v1`

### Body (application/json)

This endpoint expects a SearchInvoicesRequest.

- `cursor` (string, optional, nullable) — The `nextCursor` of the previous page, sent with the same `filters`. Leave it out, or send null, for the first page.
- `filters` (list of SearchInvoicesRequestFiltersItems, optional) — Up to 20 entries, every one of which must hold: a condition `{ field, op, values }`, or a group `{ "or": [conditions] }` that holds when at least one of its conditions does. Leave it out, or send `[]`, to match every object, as the list does.
- `limit` (integer, optional, default: 10) — How many objects to return, 1 to 100. Defaults to 10.

## Response

### 200

200

- `object` (enum, required) — The type of object. Always `list`.
  - Allowed values: `list`
- `data` (list of Invoice, required) — The invoices on this page, newest first.
- `hasMore` (boolean, required) — Whether another page follows this one.
- `nextCursor` (string, required, nullable) — Send it as `cursor` to get the next page. Null on the last page.

## Errors

### 400 Bad Request Error

400

- `error` (ApiErrorObject, required) — What went wrong, in the same shape for every /v1 error.

### 401 Unauthorized Error

401

- `error` (ApiErrorObject, required) — What went wrong, in the same shape for every /v1 error.

### 403 Forbidden Error

403

- `error` (ApiErrorObject, required) — What went wrong, in the same shape for every /v1 error.

### 409 Conflict Error

409

- `error` (ApiErrorObject, required) — What went wrong, in the same shape for every /v1 error.

### 429 Too Many Requests Error

429

- `error` (ApiErrorObject, required) — What went wrong, in the same shape for every /v1 error.

### 500 Internal Server Error

500

- `error` (ApiErrorObject, required) — What went wrong, in the same shape for every /v1 error.

## Types

### SearchInvoicesRequestFiltersItems

A condition, or an `or` group of conditions of which at least one must hold. An entry with an `or` key is a group.

- SearchInvoicesCondition: SearchInvoicesCondition
- SearchInvoicesGroup: SearchInvoicesGroup

### Invoice

A bill to one customer, in one currency, for what its order charged over a period, or for the lines of a manual invoice.

- `id` (string, required) — The invoice's ID.
- `object` (enum, required) — The type of object. Always `invoice`.
  - Allowed values: `invoice`
- `createdAt` (datetime, required) — When the object was created.
- `amounts` (InvoiceAmounts, required) — Integers in minor units of the invoice's `currency`.
- `billingContacts` (list of string, required) — The `con_` contacts who receive the invoice.
- `currency` (string, required) — Lowercase ISO 4217 currency code, e.g. `usd`.
- `customer` (string, required) — The customer billed, as its `cus_` ID. For order invoices, the order's `billTo`.
- `documents` (InvoiceDocuments, required) — Links to the issued invoice. New formats are added as fields here.
- `dueAt` (datetime, required, nullable) — When payment is due. On a draft it's projected from `paymentTerms`; finalizing keeps the same gap from `issuedAt`.
- `issuedAt` (datetime, required, nullable) — When it was finalized: the legal issue date.
- `lineCount` (integer, required) — How many lines it has. Read them with `invoices.lines.list`.
- `livemode` (boolean, required) — `true` for an object on a live account, `false` on a test account.
- `markedUncollectibleAt` (datetime, required, nullable) — When it was written off, or `null`.
- `metadata` (map from string to string, required) — String key-value pairs of your own, up to 500 characters per value. Always updatable.
- `number` (string, required, nullable) — The legal number from the account's sequence, assigned on finalize. `null` on drafts. Never reused.
- `order` (string, required, nullable) — The `ord_` order the invoice bills; `null` on manual ones.
- `overdue` (boolean, required) — `true` when `finalized`, not paid, something is still owed and `dueAt` has passed.
- `paidAt` (datetime, required, nullable) — When `paymentStatus` became `paid`, or `null`.
- `paymentStatus` (enum, required) — `null` on drafts and voided invoices; kept on `uncollectible` ones, which can still be paid.
  - Allowed values: `unpaid`, `partiallyPaid`, `paid`
- `paymentTerms` (enum, required) — From the order on order invoices; set on manual ones. `null` when a manual invoice was given only a `dueAt`.
  - Allowed values: `dueOnReceipt`, `net15`, `net30`, `net45`, `net60`, `net90`
- `period` (InvoicePeriod, required) — A span of time; `endsAt` is exclusive.
- `purchaseOrderNumber` (string, required, nullable) — Printed on the document.
- `sentAt` (datetime, required, nullable) — The last time it was emailed, or `null`.
- `source` (enum, required) — `order` when the billing run, an activation or an amendment built it from an order, `manual` when it was created with `invoices.create`.
  - Allowed values: `order`, `manual`
- `status` (enum, required) — `draft` until finalized, then `finalized`. `uncollectible` once written off, `voided` once voided; `voided` is final. Payment is `paymentStatus`, not this. Expect new values.
  - Allowed values: `draft`, `finalized`, `uncollectible`, `voided`
- `tax` (InvoiceTax, required) — Tax on the invoice.
- `updatedAt` (datetime, required) — When the object was last changed.
- `voidedAt` (datetime, required, nullable) — When it was voided, or `null`.

### ApiErrorObject

What went wrong, in the same shape for every /v1 error.

- `code` (string, required) — A stable, machine-readable code for this error. New codes may be added at any time. See [Errors](https://docs.paid.ai/preview/developers/api/errors) for what each one means and how to fix it. - `unauthorized`: The API key is missing, malformed, revoked or expired. - `session_revoked`: The session behind this token has been signed out. - `forbidden`: The credentials are valid but cannot access this account. - `insufficient_scope`: The API key's scopes do not cover this endpoint. - `user_required`: Only a person signed in to Paid can do this, not an API key: it sends email for the account or acts on its behalf. - `customer_key_forbidden`: A customer-scoped API key called an endpoint it cannot use. - `organization_required`: The request did not say which account it is for. - `auth_context_error`: Paid could not load the account for these credentials. - `invalid_version`: The API version is malformed or not a released version. - `rollback_window_expired`: The account tried to move its pinned version back after the rollback window closed. - `unknown_beta`: `Paid-Beta` names a beta that does not exist, or is malformed. - `beta_not_enabled`: The account is not enrolled in this private beta. - `beta_header_required`: A beta endpoint or field was used without opting in. - `invalid_idempotency_key`: `Idempotency-Key` is empty, longer than 255 characters, or not printable ASCII. - `idempotency_key_reused`: The `Idempotency-Key` was already used with a different request. - `idempotency_request_in_progress`: A request with this `Idempotency-Key` is still running. - `validation_error`: The request body or parameters failed validation. - `invalid_json`: The request body is not valid JSON. - `payload_too_large`: The request body exceeds 10 MB. - `resource_missing`: No resource or path matches the request. - `type_mismatch`: A polymorphic field's `type` doesn't match the sub-object sent with it, or more than one sub-object was sent. `param` names the field. - `reference_not_found`: A reference in the body or query string doesn't name a resource on the account. `param` names the field, e.g. `customer` or `lines[0].price`. - `resource_archived`: A resource the request names is archived, so it can't be used for this. `param` names the field; it's empty when the archived resource is the one in the path. - `resource_not_active`: A resource the request names isn't active: it's still a draft, has ended or was deactivated. `param` names the field. - `status_conflict`: The action can't run on the object in the path from its current `status`, e.g. activating an active order or releasing a captured hold. `message` names the status and the statuses the action needs. - `resource_in_use`: The resource can't be archived or changed this way while other resources still use it. `param` names the field when there is one. - `resource_exists`: A resource with this identifier (an `externalId`, `key` or alias) already exists on the account, ignoring letter case. `param` names the field. - `customer_mismatch`: A resource the request names belongs to a different customer than the one the request is for. `param` names the field. - `internal_error`: Something went wrong on Paid's side. - `currency_not_supported`: `currency` is not enabled on the account. - `currency_locked`: The customer has an order, so its `currency` cannot change. - `customer_has_active_orders`: The customer cannot be archived while it has an activating, active or paused order. - `parent_livemode_mismatch`: `parent` names a customer in the other mode: live for a test key, or test for a live key. - `parent_has_parent`: Parents are one level deep: the named parent has a parent of its own, or the customer being given a parent has children. - `parent_cycle`: `parent` names the customer itself, or, for a customer unit, the unit itself or a unit under it. - `has_active_children`: The customer cannot be archived while it is the `parent` of a customer that is not archived, or the customer unit while it has units under it that are not archived. - `tax_provider_not_connected`: Tax cannot be enabled while no tax provider is connected. - `mixed_tax_codes`: A prepaid commit taxed at purchase is scoped to products with different tax codes, so its invoice has no single code. - `tax_provider_unavailable`: The tax provider could not be reached, so the tax code could not be checked against its catalog. - `immutable_field`: An update tried to change a field that can't change after creation, such as a rate, a key or a reference. - `currency_mismatch`: An amount or reference isn't in the currency the request needs, such as an order's currency. - `limit_exceeded`: The request has more items than the resource allows, such as rates, adjustments, filters or outcomes. - `forfeit_confirmation_required`: Ending this would forfeit a remaining balance, and `forfeitRemaining` wasn't `true`. - `external_id_scopes_meter`: The product's `externalId` can't change while a meter is scoped to it, because the meter matches on that ID. - `percent_of_base_missing`: A percent-of line names prices in `of.lines` that aren't on the order. - `outcome_not_allowed`: `usage.outcome` was sent for an events meter, which has no outcomes. - `meter_not_priceable`: The meter can't be priced on its own: it has `groupBy`, or uses a dashboard-only feature. - `price_in_active_plan`: The price can't be archived while an active plan lists it. - `ambiguous_match`: Two rates match the same dimension values with equal specificity, so rating couldn't choose between them. - `meter_already_priced`: One measure would be priced by both a price and a rate card on the same order. - `no_common_currency`: The plan's lines share no currency. - `default_requires_upgrade_path`: `default: true` was sent on a plan with no `upgradePath`. - `plan_legacy`: The plan was converted from v2 without v1 prices, so it can't be used on a v1 order. - `upgrade_path_position_taken`: Another plan already has this `position` in the upgrade-path `group`. - `quantity_not_allowed`: A line has a `quantity`, but its price has no `unit` (a usage price or flat fee). - `quantity_out_of_range`: A `quantity` is outside the price's or line's `quantityLimits`. - `quantity_limits_wider_than_price`: A line's `quantityLimits` are wider than its price's. - `interval_mismatch`: A recurring price's interval neither divides the order's billing cycle evenly nor is a whole multiple of it. - `line_not_on_order`: An amendment change names a line from another order. - `no_material_changes`: The amendment's changes leave the order as it is. - `usage_billing_behind`: Usage for a past period hasn't been billed yet, so the usage line can't be replaced now. - `seats_exceed_quantity`: The new quantity is below the line's active seats. - `order_ambiguous`: Several orders share this `externalId`, so it can't name one of them. - `order_version_mismatch`: The order changed since the `expectedVersion` sent. - `preview_stale`: The order changed after the amendment was previewed. - `billing_unavailable`: Billing couldn't be reached to preview or apply the change. Nothing changed. - `commit_conflict`: The invoiced minimum overlaps another on the order in both time and scope. - `duplicate_outcome_key`: Two outcomes, or an outcome and `catchAll`, share a key. - `single_event_field_not_allowed`: A single-event meter sent a field only workflows or event aggregation use, such as `identifier`, `close` or `aggregation`. - `alias_unit_conflict`: `customer` is an alias of one unit and `customerUnit` names a unit outside its subtree. - `workflow_unit_conflict`: The event names a different customer unit from the open workflow it joins. - `incompatible_unit`: A strict meter reads a Quantity whose unit can't be converted to the meter's unit. - `unknown_provider`: Paid's model catalog doesn't know the inference provider. - `unknown_model`: Paid's model catalog doesn't know the model. - `range_too_large`: The range is longer than `granularity` allows. - `misaligned_range`: `startsAt` or `endsAt` doesn't fall on a bucket boundary in `timezone`. - `depth_exceeded`: The unit, or a moved subtree, would go below 16 levels. - `root_unit_immovable`: An update tried to move the customer's root unit. - `root_unit_always_billable`: A create or update tried to make the root unit non-billable. - `has_active_cap`: The unit can't be archived while it has an active spend cap. - `has_active_seat`: The unit can't be archived while it holds an active seat, or the customer is billed per seat, so its units can't be created, changed or archived. - `alias_held_by_draft_customer`: The alias value is a draft customer's external ID: usage sent under it before the alias existed made that draft. - `alias_system_managed`: The alias was made by Paid, when a customer's `externalId` changed or from a SalesBricks buyer, so it can't be updated, archived, unarchived or deleted. It has `systemManaged: true`. - `draft_has_billing`: The draft customer to merge has credit grants, pending spends or other billing postings. - `price_not_on_order`: `price` isn't on the order. - `price_not_seat_based`: `price` isn't a recurring price with `seats`. - `customer_unit_not_billable`: The customer unit has `effectiveBillable: false`, so it can't hold a seat. - `seat_limit_reached`: The seat line is full: a purchased line has `quantity` active seats, or an assigned line reached `quantityLimits.maximum`. - `unit_already_has_seat`: The unit already holds an active seat for this product. - `refill_rollover_conflict`: The grant sets both `refill` and `rollover`. - `credit_currency_key_reserved`: The credit currency `key` is an ISO 4217 currency code. - `insufficient_credits`: The customer's spendable balance in the credit currency doesn't cover the hold. Nothing was reserved. - `price_not_one_time`: The auto top-up's `price` isn't a one-time price. - `price_grants_mismatch`: The auto top-up's `price` doesn't grant the rule's credit currency. - `payment_method_required`: `collection: "chargeAutomatically"` was set, but there is no card to charge: the customer has no payment method on file, or the one named (or the default) is a bank transfer account. - `auto_top_up_conflict`: The customer already has an enabled auto top-up for this credit currency. - `invalid_request`: The request was rejected. - `not_found`: The requested resource does not exist. - `conflict`: The request conflicts with the resource's current state. - `rate_limited`: Too many requests in too short a time. - `api_error`: An unexpected error.
- `docUrl` (string, required) — A link to this code's entry on the errors page, or to the page itself for an undocumented code.
- `message` (string, required) — A human-readable explanation of what went wrong.
- `requestId` (string, required) — The ID of the request, also returned in the `Request-Id` header. Include it when contacting support.
- `type` (enum, required) — The category of error.
  - Allowed values: `invalid_request_error`, `authentication_error`, `permission_error`, `idempotency_error`, `rate_limit_error`, `api_error`
- `param` (string, optional) — The request field or header the error relates to, when there is one.

### SearchInvoicesCondition

One condition on a field of the invoices searched.

- `field` (string, required) — The field to compare, with the operators it takes: * `customer` (`eq`, `ne`, `in`, `notIn`): The customer billed: its `cus_` ID, your `externalId` or one of its aliases, as the list's filter takes it. A value that names nothing is refused with `reference_not_found` before the search runs. Invoices of archived customers are included. * `customer.name` (`eq`, `ne`, `in`, `notIn`, `startsWith`, `contains`): The billed customer's `name` as it is now, not when the invoice was issued. Every operator ignores case. * `customer.email` (`eq`, `ne`, `in`, `notIn`, `startsWith`, `contains`): The billed customer's `email` as it is now. Every operator ignores case. A customer with no email has none. * `order` (`eq`, `ne`, `in`, `notIn`): The `ord_` order the invoice bills, by its `ord_` ID only, as the list's filter takes it. A value that names nothing is refused with `reference_not_found` before the search runs. Manual invoices have none, so no `order` condition matches them. * `status` (`eq`, `ne`, `in`, `notIn`): The invoice's `status`: `draft`, `finalized`, `uncollectible`, `voided`. * `paymentStatus` (`eq`, `ne`, `in`, `notIn`): The invoice's `paymentStatus`: `unpaid`, `partiallyPaid`, `paid`. Drafts and voided invoices have none. * `overdue` (`eq`): The invoice's `overdue`, as the returned invoice has it at the time of the request: `true` matches overdue invoices, `false` every other, a finalized unpaid invoice with no `dueAt` included (where the list's `overdue=false` leaves those out). * `source` (`eq`, `ne`, `in`, `notIn`): How the invoice was made: `order`, `manual`. * `currency` (`eq`, `ne`, `in`, `notIn`): The `currency`: a lowercase ISO 4217 code, checked as the list's filter checks it. * `number` (`eq`, `ne`, `in`, `notIn`, `startsWith`, `contains`): The legal `number`. `eq`, `ne`, `in` and `notIn` compare exactly, case included, as the list's filter does. Drafts have none. * `purchaseOrderNumber` (`eq`, `ne`, `in`, `notIn`, `startsWith`, `contains`): The `purchaseOrderNumber`. `eq`, `ne`, `in` and `notIn` compare exactly, case included, as the list's filter does. An invoice without one has none. * `issuedAt` (`gt`, `gte`, `lt`, `lte`): The returned invoice's `issuedAt`: when it was finalized, read as the invoice returns it. Drafts have none. The list's `issuedAt[gte]` and `issuedAt[lt]` read only the posting date, so an issued invoice without one is found by search but not by the list. * `dueAt` (`gt`, `gte`, `lt`, `lte`): When payment is due. An invoice without one has none. * `amounts.total` (`eq`, `ne`, `gt`, `gte`, `lt`, `lte`): `amounts.total`, in minor units of the invoice's `currency`. Compare it within one currency. * `amounts.remaining` (`eq`, `ne`, `gt`, `gte`, `lt`, `lte`): `amounts.remaining`, what's still owed, in minor units of the invoice's `currency`. * `createdAt` (`gt`, `gte`, `lt`, `lte`): When the invoice was created. * `updatedAt` (`gt`, `gte`, `lt`, `lte`): When the invoice was last changed. * `metadata.<key>` (`eq`, `ne`, `in`, `notIn`, `startsWith`, `contains`): The value stored under `<key>` in the object's `metadata`, everything after `metadata.` taken whole as the key (dots included, up to 255 characters, no NUL). Only a value stored as a string counts: a number or boolean saved through the legacy API has no value for search, even where the object returns it as a string. `eq`, `ne`, `in` and `notIn` compare exactly, case included.
- `op` (enum, required) — How to compare. `eq` and `ne` take one value, `in` and `notIn` a list. `gt`, `gte`, `lt` and `lte` compare a number or a timestamp with one value. `startsWith` matches the start of a text field's value and `contains` any part of it, both ignoring case, with one value; `contains` needs at least 3 characters. Each field takes only the operators listed against it. A field with no value (null on the object returned) matches no condition, `ne` and `notIn` included.
  - Allowed values: `eq`, `ne`, `in`, `notIn`, `gt`, `gte`, `lt`, `lte`, `startsWith`, `contains`
- `values` (list of string, required) — The values to compare with, as strings, 1 to 100 of 1 to 500 characters each, without the NUL character; exactly one for every operator but `in` and `notIn`. An amount is an optional `-` and 1 to 18 digits of minor units (`"100000"`), a timestamp ISO 8601 UTC ending in `Z` with at most 3 fractional-second digits, a boolean `"true"` or `"false"`, a currency a lowercase ISO 4217 code.

### SearchInvoicesGroup

Conditions of which at least one must hold. A group holds conditions only, never another group.

- `or` (list of SearchInvoicesCondition, required) — 1 to 10 conditions, at least one of which must hold. Groups don't nest.

### InvoiceAmounts

Integers in minor units of the invoice's `currency`.

- `credited` (integer, required) — Credit notes applied to the invoice.
- `discounts` (integer, required) — Discounts on every line.
- `paid` (integer, required) — Payments allocated to the invoice.
- `remaining` (integer, required) — `total` − `credited` − `paid`: what's still owed.
- `subtotal` (integer, required) — `subtotalBeforeDiscounts` − `discounts`. Commit drawdowns and proration credits are negative lines inside it.
- `subtotalBeforeDiscounts` (integer, required) — Every line before discounts.
- `tax` (integer, required) — Tax on `subtotal`.
- `total` (integer, required) — `subtotal` + `tax`. Never negative.

### InvoiceDocuments

Links to the issued invoice. New formats are added as fields here.

- `hostedUrl` (string, required, nullable) — The customer-facing page. Anyone with the link can open it. `null` until finalized.
- `pdfUrl` (string, required, nullable) — The PDF. `null` until finalized.
- `ublUrl` (string, required, nullable) — The UBL 2.1 e-invoice, `null` unless e-invoicing is on for the account.

### InvoicePeriod

A span of time; `endsAt` is exclusive.

- `endsAt` (datetime, required) — When the span ends, exclusive.
- `startsAt` (datetime, required) — When the span starts.

### InvoiceTax

Tax on the invoice.

- `breakdown` (list of InvoiceTaxBreakdown, required) — Tax by jurisdiction. Empty until tax is calculated.
- `exempt` (boolean, required) — Whether the customer is tax-exempt.
- `status` (enum, required) — `notApplicable` with no tax provider, `pending` until calculated (or after an edit), `calculated`, or `failed` when the provider refused. Expect new values.
  - Allowed values: `notApplicable`, `pending`, `calculated`, `failed`

### InvoiceTaxBreakdown

One jurisdiction's share of the tax.

- `amount` (integer, required) — The tax, in minor units.
- `jurisdiction` (string, required, nullable) — The level the tax is owed at, as the provider reports it, e.g. `State`.
- `name` (string, required, nullable) — The tax's name, as the provider reports it.
- `rate` (string, required, nullable) — The rate as a decimal percentage string.
- `taxableAmount` (integer, required, nullable) — What the rate applied to, in minor units, when the provider reports it.

## Examples

**Request**

```json
{
  "filters": [
    {
      "field": "status",
      "op": "eq",
      "values": [
        "finalized"
      ]
    },
    {
      "field": "amounts.total",
      "op": "gte",
      "values": [
        "100000"
      ]
    },
    {
      "or": [
        {
          "field": "customer.name",
          "op": "contains",
          "values": [
            "northwind"
          ]
        },
        {
          "field": "customer.email",
          "op": "contains",
          "values": [
            "northwind"
          ]
        }
      ]
    }
  ],
  "limit": 20
}
```

**Response**

```json
{
  "object": "list",
  "data": [
    {
      "id": "inv_7Rk2Pd",
      "object": "invoice",
      "createdAt": "2024-01-15T09:30:00Z",
      "amounts": {
        "credited": 0,
        "discounts": 0,
        "paid": 0,
        "remaining": 0,
        "subtotal": 0,
        "subtotalBeforeDiscounts": 0,
        "tax": 0,
        "total": 0
      },
      "billingContacts": [
        "con_4Ld8Qe"
      ],
      "currency": "usd",
      "customer": "cus_9Aa2Bc",
      "documents": {
        "hostedUrl": "https://pay.paid.ai/i/7f3c9a",
        "pdfUrl": "https://pay.paid.ai/i/7f3c9a/pdf",
        "ublUrl": null
      },
      "dueAt": "2024-01-15T09:30:00Z",
      "issuedAt": "2024-01-15T09:30:00Z",
      "lineCount": 3,
      "livemode": true,
      "markedUncollectibleAt": "2024-01-15T09:30:00Z",
      "metadata": {
        "crmId": "0015g00000XyZ"
      },
      "number": "INV-0142",
      "order": "ord_5Kp2Wz",
      "overdue": false,
      "paidAt": "2024-01-15T09:30:00Z",
      "paymentStatus": "unpaid",
      "paymentTerms": "net30",
      "period": {
        "endsAt": "2024-01-15T09:30:00Z",
        "startsAt": "2024-01-15T09:30:00Z"
      },
      "purchaseOrderNumber": "PO-88213",
      "sentAt": "2024-01-15T09:30:00Z",
      "source": "order",
      "status": "finalized",
      "tax": {
        "breakdown": [
          {
            "amount": 0,
            "jurisdiction": "State",
            "name": "New York State and City sales tax",
            "rate": "8.875",
            "taxableAmount": 1093150
          }
        ],
        "exempt": false,
        "status": "calculated"
      },
      "updatedAt": "2024-01-15T09:30:00Z",
      "voidedAt": "2024-01-15T09:30:00Z"
    }
  ],
  "hasMore": true,
  "nextCursor": "cur_9Vb3Lm"
}
```

**SDK Code**

```python
import requests

url = "https://api.paid.ai/v1/invoices/search"

payload = {
    "filters": [{
            "field": "status",
            "op": "eq",
            "values": ["finalized"]
        }, {
            "field": "amounts.total",
            "op": "gte",
            "values": ["100000"]
        }, { "or": [
                {
                    "field": "customer.name",
                    "op": "contains",
                    "values": ["northwind"]
                },
                {
                    "field": "customer.email",
                    "op": "contains",
                    "values": ["northwind"]
                }
            ] }],
    "limit": 20
}
headers = {
    "Paid-Beta": "search=v1",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.paid.ai/v1/invoices/search';
const options = {
  method: 'POST',
  headers: {
    'Paid-Beta': 'search=v1',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"filters":[{"field":"status","op":"eq","values":["finalized"]},{"field":"amounts.total","op":"gte","values":["100000"]},{"or":[{"field":"customer.name","op":"contains","values":["northwind"]},{"field":"customer.email","op":"contains","values":["northwind"]}]}],"limit":20}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.paid.ai/v1/invoices/search"

	payload := strings.NewReader("{\n  \"filters\": [\n    {\n      \"field\": \"status\",\n      \"op\": \"eq\",\n      \"values\": [\n        \"finalized\"\n      ]\n    },\n    {\n      \"field\": \"amounts.total\",\n      \"op\": \"gte\",\n      \"values\": [\n        \"100000\"\n      ]\n    },\n    {\n      \"or\": [\n        {\n          \"field\": \"customer.name\",\n          \"op\": \"contains\",\n          \"values\": [\n            \"northwind\"\n          ]\n        },\n        {\n          \"field\": \"customer.email\",\n          \"op\": \"contains\",\n          \"values\": [\n            \"northwind\"\n          ]\n        }\n      ]\n    }\n  ],\n  \"limit\": 20\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Paid-Beta", "search=v1")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.paid.ai/v1/invoices/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Paid-Beta"] = 'search=v1'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"filters\": [\n    {\n      \"field\": \"status\",\n      \"op\": \"eq\",\n      \"values\": [\n        \"finalized\"\n      ]\n    },\n    {\n      \"field\": \"amounts.total\",\n      \"op\": \"gte\",\n      \"values\": [\n        \"100000\"\n      ]\n    },\n    {\n      \"or\": [\n        {\n          \"field\": \"customer.name\",\n          \"op\": \"contains\",\n          \"values\": [\n            \"northwind\"\n          ]\n        },\n        {\n          \"field\": \"customer.email\",\n          \"op\": \"contains\",\n          \"values\": [\n            \"northwind\"\n          ]\n        }\n      ]\n    }\n  ],\n  \"limit\": 20\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.paid.ai/v1/invoices/search")
  .header("Paid-Beta", "search=v1")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"filters\": [\n    {\n      \"field\": \"status\",\n      \"op\": \"eq\",\n      \"values\": [\n        \"finalized\"\n      ]\n    },\n    {\n      \"field\": \"amounts.total\",\n      \"op\": \"gte\",\n      \"values\": [\n        \"100000\"\n      ]\n    },\n    {\n      \"or\": [\n        {\n          \"field\": \"customer.name\",\n          \"op\": \"contains\",\n          \"values\": [\n            \"northwind\"\n          ]\n        },\n        {\n          \"field\": \"customer.email\",\n          \"op\": \"contains\",\n          \"values\": [\n            \"northwind\"\n          ]\n        }\n      ]\n    }\n  ],\n  \"limit\": 20\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.paid.ai/v1/invoices/search', [
  'body' => '{
  "filters": [
    {
      "field": "status",
      "op": "eq",
      "values": [
        "finalized"
      ]
    },
    {
      "field": "amounts.total",
      "op": "gte",
      "values": [
        "100000"
      ]
    },
    {
      "or": [
        {
          "field": "customer.name",
          "op": "contains",
          "values": [
            "northwind"
          ]
        },
        {
          "field": "customer.email",
          "op": "contains",
          "values": [
            "northwind"
          ]
        }
      ]
    }
  ],
  "limit": 20
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Paid-Beta' => 'search=v1',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.paid.ai/v1/invoices/search");
var request = new RestRequest(Method.POST);
request.AddHeader("Paid-Beta", "search=v1");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"filters\": [\n    {\n      \"field\": \"status\",\n      \"op\": \"eq\",\n      \"values\": [\n        \"finalized\"\n      ]\n    },\n    {\n      \"field\": \"amounts.total\",\n      \"op\": \"gte\",\n      \"values\": [\n        \"100000\"\n      ]\n    },\n    {\n      \"or\": [\n        {\n          \"field\": \"customer.name\",\n          \"op\": \"contains\",\n          \"values\": [\n            \"northwind\"\n          ]\n        },\n        {\n          \"field\": \"customer.email\",\n          \"op\": \"contains\",\n          \"values\": [\n            \"northwind\"\n          ]\n        }\n      ]\n    }\n  ],\n  \"limit\": 20\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Paid-Beta": "search=v1",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "filters": [[
      "field": "status",
      "op": "eq",
      "values": ["finalized"]
    ], [
      "field": "amounts.total",
      "op": "gte",
      "values": ["100000"]
    ], ["or": [
        [
          "field": "customer.name",
          "op": "contains",
          "values": ["northwind"]
        ],
        [
          "field": "customer.email",
          "op": "contains",
          "values": ["northwind"]
        ]
      ]]],
  "limit": 20
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.paid.ai/v1/invoices/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```