# v2 API

Source: https://dalp-staging.settlemint.com/docs/changelog/dalp-3-0/v2-api
The v2 API at /api/v2 lets integrations filter, sort and page lists, track a write through settlement and retry it safely where its route allows.

**Your integration asks the platform for exactly the records it needs and knows what happened to every write it sends.** A core banking system that pulls whole lists, or resends a payment instruction after a dropped connection, risks slow reconciliation and duplicate movements. DALP 3.0 adds a typed v2 API with filters, sorting, paging and a choice between waiting for settlement and tracking it.

Spotlight: One query style for every list, and one settlement contract for every write

List endpoints share the JSON:API query style for filters, sorting and paging. A write returns its settled result or a status URL, depending on how long the caller asks the platform to wait.

## Before and after [#before-and-after]

**Before 3.0:** the v1 API returned whole sets with no structured filtering, so an integration fetched more than it needed and filtered on its own side. A write that timed out left the caller unsure whether it had reached the chain, and a blind resend could submit the instruction twice.

**With 3.0:** the v2 API filters and sorts on the server, pages with links, and lets each write either wait for settlement or return a status URL at once. On routes whose contract documents replay, a retry with the same idempotency key returns the original result instead of a second instruction.

[Figure] How a v2 mutation settles when the caller asks the platform to wait. A mutation is queued and returns 200 OK with the settled result if it settles within the wait budget, or 202 Accepted with a status URL to poll if the budget runs out, and a retry with the same idempotency key on a replay-safe route returns the original result. Labels: POST mutation; Integration; Idempotency-Key, Prefer; Queued; Platform; Runs in the background; 200 OK; Settled within N; Settled result inline; 202 Accepted; Budget elapsed; Status URL to poll; Poll status; Integration; Until a terminal state; Retry, same key; Uncertain reply; On replay-safe routes.

A mutation returns 200 with the settled result within its wait or 202 with a status URL, and, on a route whose contract documents replay, a retry with the same idempotency key returns the original result.

## Ask for the records you need [#ask-for-the-records-you-need]

List endpoints take filters in JSON:API bracket notation, such as `filter[name]=Treasury`, with an optional operator in a second bracket. Sort with `sort=-createdAt`, or with `sortBy` and `sortDirection`, using one form per request. Each resource accepts only the sort fields its contract lists and rejects any other.

![Activity page with a chart of events over time, filters for the event, the asset and the time range, and a table of events](https://dalp-staging.settlemint.com/docs/screenshots/console-activity-events.light.en.webp)

[Screenshot] The Activity page narrows a long event history to the time range, event or asset you need.

Supported filter operators fall into three groups:

- **Comparison:** `eq`, `ne`, `gt`, `gte`, `lt` and `lte`.
- **Case-insensitive match:** `iLike` and `notILike`.
- **Range, set and emptiness:** `between`, `inArray`, `notInArray`, `isEmpty` and `isNotEmpty`.

A Developer building the bank's register sync asks for the 50 most recent tokens whose name matches Treasury:

```http
GET /api/v2/tokens?filter[name]=Treasury&sort=-createdAt&page[limit]=50&page[offset]=0
```

The response carries the page and the links to the next one, so the sync walks the set without computing offsets. The register gets only the rows it needs, and a nightly reconciliation runs on a smaller data set. An `inArray` or `notInArray` filter uses the first 100 values and ignores the rest, so a longer exclusion list must be split across requests.

## Choose whether a write waits for settlement [#choose-whether-a-write-waits-for-settlement]

A blockchain write takes seconds to settle, and longer when the network is busy. A v2 transaction write is queued and returns `202 Accepted` with a status URL. Send `Prefer: wait=N` to hold the response for up to N seconds, clamped to between 5 and 99, and `Prefer: respond-async` for the status URL at once. The `Preference-Applied` response header echoes the directives honoured.

A Developer's payment job issues a mint with `Prefer: wait=10`. On a quiet network the mint settles in four seconds, and the job receives `200 OK` with the settled result and books it straight away. On a busy afternoon the same call returns `202 Accepted` after ten seconds, and the job polls the status URL until the mint completes.

In both cases the token supply changes once, because DALP queues the mint once whether or not the job waits. The 3.0 TypeScript SDK sends `Prefer: wait=99` on every mutation unless you set your own `Prefer` header.

A slow block no longer ties up a connection or loses a result, because the work runs whether or not the caller waits. A wait changes only how the result is delivered, so a `202` is not a failure and the job must keep the status URL until the operation finishes.

## Retry a write after an uncertain reply [#retry-a-write-after-an-uncertain-reply]

A lost reply is the case an idempotency key covers. Send an `Idempotency-Key` header with a mutation, and on a route whose contract documents replay, DALP runs the instruction once and returns the original result to a retry with the same key. Generate one key per instruction, store it with your own job id, and reuse it only to retry that same request.

A Developer's job sends a transfer and the connection drops before the reply. The job resends the same body with the same key, and the API returns the transfer it already accepted, so the holder receives the units once. [Idempotency and async settlement](https://dalp-staging.settlemint.com/docs/api-reference/guides/idempotency-async-settlement) gives the request contract and how long a key is kept.

A key protects only routes whose contract documents replay, so check the route before you rely on a retry.

## Choose how each transaction is sent [#choose-how-each-transaction-is-sent]

`X-Executor` selects how a transaction is sent, `eoa` from the account's own key address or `smart-wallet` from its smart wallet, and leaving it out uses the organisation's default. `X-Participant` names the participant the request acts as, in `pp_<uuid>` form. v2 errors carry the same envelope as the SDK and CLI: a stable `DALP-` id, category, retryable flag, message, `why` and `fix`.

A Developer's organisation sends transactions from smart wallets by default, with the gas sponsored. One maintenance script must send from the account's own key address, so it sets `X-Executor: eoa` on those calls, and the rest of the integration keeps the organisation's default. When a call is refused, the script reads the category and the retryable flag to decide whether to stop or try again.

An integration picks the sending path per call without a second credential. In 3.0, `X-Participant` must name the participant of the session itself, so one key acts as one participant.

## Upgrading [#upgrading]

Nothing to do. In 3.0 the v1 API at `/api/v1` keeps its request and response shapes, and its specification remains at `/api/v1/spec.json`. `/api` redirects to `/api/v2`, where the interactive reference and the OpenAPI specification are served. Build new integrations on v2, and check the v2 reference for each v1 operation you rely on before you move it. v2 becomes stable only from 3.2, which removes some v2 operations published before it, so read [3.2 compatibility](https://dalp-staging.settlemint.com/docs/changelog/dalp-3-2#compatibility) before you build on these shapes.

## Why it matters [#why-it-matters]

- **Banks:** your core systems pull only the records they reconcile, and a lost reply does not turn into a second payment instruction on replay-safe routes.
- **Exchanges, CSDs and market infrastructures:** each write either returns its settled result or a status URL you can track to a terminal state.
- **Partners:** your product reads DALP data in one query style and branches on each refusal by its fields.

## Next steps [#next-steps]

- [Track async writes and settlement →](https://dalp-staging.settlemint.com/docs/api-reference/guides/idempotency-async-settlement)
- [Page through collections →](https://dalp-staging.settlemint.com/docs/api-reference/guides/pagination)
- [Understand the transaction queue →](https://dalp-staging.settlemint.com/docs/concepts/settlement/transaction-queue)