Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

/v3/limit - Manage and cancel orders

Read a single order, paginate the orders an API key owns, and run the two-call cancel flow.

Steps 4–7 of the order flow, for orders that already exist: read one, page through many, and cancel. Steps 1–3 — quote, build and submit — are on Place an order.

Order state follows the status lifecycle, and fills and terminal transitions also reach your webhook if one is configured.


4. Single-order detail

Method: GET URL: https://api.swapkit.dev/v3/limit/orders/:orderId

Returns one order, synced with the provider on every call.

Order object

Field
Type
Description

orderId

UUID string

UUID of the order.

orderHash

string

The provider's order identifier, fixed for the order's life. 1inch: the 0x digest of the signed order. Harbor: an opaque 0x hash SwapKit assigns. NEAR Intents: the 1Click order id. The deposit's tx hash is depositHash, not this.

chainId

string enum

Sell-asset chain: a numeric string for EVM ("1", "42161"), a slug otherwise ("bitcoin", "solana").

provider

enum

Provider that routed the order.

maker

string

Sell-chain address that owns the order.

receiver

string or null

Buy-chain address that receives the proceeds. null only on legacy orders.

sellAsset

string

Asset sold, e.g. "ETH.ETH".

buyAsset

string

Asset bought, e.g. "BTC.BTC".

sellAmount

decimal string

Amount sold. Human-readable, unlike /v3/quote and /v3/swap.

buyAmount

decimal string

Amount the order is resting for. Human-readable.

limitPrice

decimal string

buyAsset per 1 sellAsset.

filledSellAmount, filledBuyAmount

decimal string

"0" until a fill. All-or-nothing providers jump to the full amounts; partial-fill providers climb.

txHashes

TxHash[]

The order's on-chain transactions, oldest first; [] until one lands. Entry shape below.

cancelRequestedAt

ISO 8601 string?

Set while an asynchronous cancel (NEAR Intents) is pending; gone once the order is CANCELLED. See below.

usdValueOpen

string or null

Approximate USD value of the sell side at build. null if no price was found.

usdValueClose

string or null

Approximate USD value of what has filled. null until something fills; final once the order is terminal.

status

enum

fees

Fee[]

Fees on the order. See below.

depositHash

string?

The depositTxHash you submitted: as sent on NEAR Intents and 1inch native sells, lowercased on Harbor. Omitted before submit, and on signed-intent orders.

withdrawHash

string?

Harbor only. Harbor's payout transaction, lowercase 0x: the settlement after a fill, or the refund after a cancel or expiry. On other providers, see txHashes.

expiresAt

ISO 8601 string

When SwapKit marks the order EXPIRED. Harbor and NEAR Intents then refund the deposit; a 1inch native sell does not — cancel it to release the escrow.

createdAt, updatedAt

ISO 8601 string

Server timestamps. updatedAt moves whenever sync writes new state.

The txHashes entries

Field
Type
Description

txHash

string

The transaction hash.

type

enum

fill or cancel on 1inch; deposit, withdraw or refund on Harbor and NEAR Intents. Open enum.

chainId

string enum

Chain the transaction is on. Not always the sell chain: a withdraw lands on the buy chain.

blockNumber

integer (optional)

Block number, where the provider reports it.

Fees breakdown

Each entry in fees[] has this shape. Not every provider charges every type.

Field
Type
Description

type

enum

liquidity (the provider's fee), affiliate (yours, from your API key config), service (SwapKit's, currently 0) or network (destination-chain gas or outbound fee).

amount

string

Human-readable amount.

amountBps

number (optional)

The fee in bps.

asset

string

Asset the fee is in.

chain

string

Chain the fee is paid on.

protocol

enum

Provider charging the fee.

Fee figures are projections until settlement, and chain is the fee asset's own rather than the sell chain's — a USDT fee reports "ETH".

Fee type
Until the order fills
After a fill
Ended without ever filling (CANCELLED, EXPIRED, FAILED)

liquidity

Projected.

Replaced with the actual value by providers that report settlement figures. NEAR Intents settles none.

0

affiliate, service

Projected. NEAR Intents charges both on the input, so they land in the sell asset.

Still projected.

0

network

Projected. On NEAR Intents a delivery fee in the buy asset — it becomes a refund fee in the sell asset once the order reaches CANCELLED or EXPIRED.

Replaced with the actual value by providers that report settlement figures. NEAR Intents settles none.

Not 0: on NEAR Intents the real refund fee, on Harbor still the estimate from build.

Errors

Status
Error code
Scenario

404

limitOrderNotFound

Unknown orderId.

401

unauthorized

The order belongs to another API key, or the key isn't recognised.

401

apiKeyInvalid

Missing x-api-key.

400

validation_error

orderId isn't a UUID.


5. Paginated order list

Method: GET URL: https://api.swapkit.dev/v3/limit/orders

Your API key's orders, newest first. It does not re-sync with the provider — use /v3/limit/orders/:orderId when freshness matters.

Query parameters

All optional, and unknown keys are ignored. Results are always limited to your API key's orders.

Parameter
Type
Description

sourceAddress

string

Filter by maker. EVM addresses match case-insensitively; others match exactly.

destinationAddress

string

Filter by receiver. Same matching as sourceAddress.

sourceChain

string enum

Filter by sell chain, using the order's chainId values ("1", "bitcoin", …).

destinationChain

string enum

Filter by buy chain. Orders created before SwapKit recorded the buy chain never match.

joinType

enum

How each pair of filters combines when both halves are set: fullOuter (default) is OR, inner is AND.

status

enum or enum[]

One or more statuses: ?status=FILLED, ?status=PENDING&status=FILLED or ?status=PENDING,FILLED. If omitted: active orders only, or every status with updatedSince.

updatedSince

ISO 8601 string

Only orders changed at or after this time (with an offset, e.g. Z), oldest change first. updatedAt moves when the order itself changes, not on a sync that finds nothing new. It's set as we record the change, a moment before the change can be read back — milliseconds usually, but our instances' clocks differ, so go back a few minutes from the last updatedAt you saw rather than starting exactly at it.

cursor

string

The previous page's nextCursor, unchanged, with the same updatedSince and filters.

limit

int (1–100)

Page size. Default 50.

There is no provider filter — filter by sourceChain / destinationChain instead.

List response schema

Field
Type
Description

orders

Order[]

See the order object.

nextCursor

string (optional)

Present when the page is full, so the last page may be followed by an empty one. Absent after a short page.

To iterate: start with no cursor, then keep passing nextCursor until the response omits it.

Examples

Errors

Status
Error code
Scenario

400

validation_error

A limit outside 1–100, an updatedSince without an offset, or an invalid filter value. The body lists accepted values.

400

limitOrderInvalidCursor

cursor isn't a nextCursor from this endpoint, or came from a listing with a different updatedSince mode.

401

apiKeyInvalid

Missing x-api-key.

401

unauthorized

Unrecognised x-api-key.


6. Cancel an order

Method: POST URL: https://api.swapkit.dev/v3/limit/cancel/build

Force-syncs the order and returns what the wallet must sign or broadcast to cancel it, if anything.

Cancelling an order. POST /v3/limit/cancel/build returns one of three things: cancelTx, which the wallet broadcasts before you send txHash; typedData, btcSignaturePreimage or messageToSign, which the wallet signs before you send signature; or all nulls, meaning nothing to sign, so you send orderId alone. Every path then calls POST /v3/limit/cancel/submit. On 1inch and Harbor the order is CANCELLED; on NEAR Intents it stays open with cancelRequestedAt set and reaches CANCELLED within minutes.
Always two calls. What happens between them depends on which field /cancel/build returns.

Request schema

Parameter
Type
Required
Description

orderId

string

Yes

The order to cancel.

Cancel build response schema

Branch on which artifact is set, not on the provider. All of them null is a valid case: there is nothing to sign.

Field
Type
Description

orderId

string

The order being cancelled.

cancelTx

object (optional)

Cancel transaction to broadcast. 1inch.

typedData

object (optional)

EIP-712 cancel message to sign. Harbor EVM, and NEAR Intents on EVM.

btcSignaturePreimage

string (optional)

String to sign as a Bitcoin Signed Message. Harbor BTC, and NEAR Intents on Bitcoin.

messageToSign

object (optional)

{ scheme, message } to sign. NEAR Intents: ed25519 on Solana, tip191 on Tron, bip137 on the Bitcoin family.

nextActions

object[]

The /v3/limit/cancel/submit request to send next. Follow this rather than inferring from the body.

The wallet broadcasts a cancel transaction. It invalidates only this order and leaves token allowances alone. On a 1inch native sell it targets the order's escrow, which also returns the funds.

Send it from cancelTx.from — the contract checks msg.sender, so another sender reverts. Then post the txHash to /v3/limit/cancel/submit.

An EIP-712 cancel message; nothing goes on-chain. Harbor's uses CancelAndWithdraw:

Sign it exactly as returned. payload.orderId is Harbor's own order id (trd-…), not SwapKit's orderId. nonce and expiry are JSON numbers below Number.MAX_SAFE_INTEGER; expiry is in unix seconds.

The wallet signs the canonical-JSON string as a Bitcoin Signed Message (BIP-137).

Submit the base64-encoded compact secp256k1 signature.

If you rebuild the preimage instead of signing it as returned, note that it uses snake_case l1_address (EVM uses l1Address), and its domain is a flat string rather than EVM's { name, version } object.

That's a Solana sell. EVM sells return typedData instead, Tron uses tip191, and the Bitcoin family uses bip137 — with btcSignaturePreimage set as well on Bitcoin itself. Sign what came back and pass it as signature to /v3/limit/cancel/submit.

Every other sell chain, and Bitcoin taproot and script (P2SH/P2WSH) addresses, return all nulls and cancel with { orderId } alone. Either way the cancel is asynchronous — see below.

When an order can be cancelled

/v3/limit/cancel/build re-checks the freshly synced order, so it catches one that filled or expired while you weren't looking.

  • Harbor: only once Harbor has seen the deposit — usually by OPEN, sometimes already at SUBMITTED. Nothing exists upstream before that.

  • NEAR Intents: any time, even a PENDING, never-funded order, because /v3/limit/build creates the upstream order.

  • Every provider: never once the order is terminal (FILLED, CANCELLED, EXPIRED, FAILED) — with one exception:

Why two calls, when /cancel/submit could do it alone?

So one cancel flow works on every provider: call /cancel/build, do what the response says, call /cancel/submit — no branching on the provider.

On most orders the two steps are genuinely needed. 1inch's cancelTx is the only thing there is to broadcast. Harbor's /cancel/build, and NEAR Intents' on every sell chain that needs a signature, saves the nonce and expiry that /cancel/submit checks the signature against — skip build and submit refuses the cancel.

Only NEAR Intents' unsigned sell chains still accept a bare /cancel/submit, and that list shrinks as signature checks are added. Write the flow once, with both calls.

Errors

Status
Error code
Scenario

409

limitOrderInvalidState

Not cancellable: terminal (see the exception above), or Harbor hasn't seen the deposit yet. The message says which.

400

limitOrderCancelFailed

The provider can't build a cancel for this order.

400

validation_error

orderId missing or not a UUID.

404

limitOrderNotFound

Unknown orderId.

401

unauthorized

Another API key's order, or an unrecognised key.

503

limitOrderActionUnavailable

Cancelling is switched off for one of the order's chains. Can clear without a change on your side.


7. Submit the cancellation

Method: POST URL: https://api.swapkit.dev/v3/limit/cancel/submit

Records the cancel transaction or signature — or, when /v3/limit/cancel/build returned nothing, cancels the order itself. This is the call that cancels; /cancel/build never does.

Request schema

Parameter
Type
Required for
Description

orderId

string

All cancellations

The order to cancel.

txHash

string

cancelTx

Hash of the broadcast cancel transaction: 0x and 64 hex characters.

signature

string

typedData, btcSignaturePreimage, messageToSign

The wallet's signature: 0x-hex for EIP-712 or TIP-191, base64 for BIP-137 or ed25519.

Send whatever /v3/limit/cancel/build asked for; when it returned nothing, orderId alone.

Cancel submit response schema

Field
Type
Description

orderId

string

UUID of the order.

status

enum

Status after the request: CANCELLED on 1inch and Harbor; still SUBMITTED, OPEN or PARTIAL on NEAR Intents. Recovering a terminal 1inch native sell's escrow leaves its status as it was.

txHash

string (optional)

The cancel transaction's hash. cancelTx path only.

withdrawId

string (optional)

Harbor's withdrawal id. Harbor only.

cancelRequestedAt

ISO 8601 string?

Set when an asynchronous cancel was accepted but hasn't settled.

Follow it by polling GET /v3/limit/orders/:orderId, which force-syncs, or over the webhook, and design for two things:

  • Don't retry on a non-CANCELLED response. cancelRequestedAt means the request was accepted. A retry is harmless — the first request wins and the timestamp isn't reset — but it won't make the order terminal sooner.

  • A slice can still fill meanwhile. The order stays non-terminal so a fill that lands mid-cancel is recorded, not dropped. filledSellAmount / filledBuyAmount can move after you've asked to cancel.

Errors

Status
Error code
Scenario

409

limitOrderInvalidState

Not cancellable now: terminal or already cancelled, not yet known to the provider, an expired payload or the wrong artifact (Harbor), or a NEAR Intents phase that can't be cancelled. The message says which.

400

limitOrderCancelFailed

The provider rejected the cancel, or 1inch got no txHash. On Harbor also an upstream outage: worth one retry.

403

limitOrderCancelSignatureInvalid

On a NEAR Intents sell chain that needs a signature: signature is missing or isn't the maker's, or there's no live payload to check it against — /cancel/build wasn't called, or its payload expired.

400

limitOrderRejected

NEAR Intents refused the cancel; the message gives its reason.

400

validation_error

orderId isn't a UUID, or txHash isn't 0x and 64 hex characters.

404

limitOrderNotFound

Unknown orderId, or NEAR Intents has no record of the order.

401

unauthorized

Another API key's order, or an unrecognised key.

502

limitOrderProviderError

NEAR Intents failed upstream (5xx or transport). Retry; the order is unchanged.

503

limitOrderActionUnavailable

Cancelling is switched off for one of the order's chains.

Last updated