openapi: 3.1.0
info:
title: DFlow Aggregator admin order API
description: DFlow Aggregator API
license:
name: BUSL-1.1
version: 0.1.0
servers:
- url: https://quote-api.dflow.net
security:
- api_key: []
tags:
- name: order
description: Order API endpoints
paths:
/order:
get:
tags:
- order
summary: Returns a quote and optionally a transaction
operationId: order_handler
parameters:
- name: userPublicKey
in: query
description: 'Base58-encoded address of the swapper''s wallet. If specified, the response will include a
transaction allowing the user to submit the order.'
required: false
schema:
type: string
- name: inputMint
in: query
description: Base58-encoded input mint address
required: true
schema:
type: string
- name: outputMint
in: query
description: Base58-encoded output mint address
required: true
schema:
type: string
- name: amount
in: query
description: Input amount as a scaled integer. For example, 1 SOL is 1000000000.
required: true
schema:
type: integer
format: int64
minimum: 0
- name: slippageBps
in: query
description: "Max allowed slippage for the swap. Default is \"auto\". Allowed values are:\n- a u16 which specifies the maximum allowed slippage in basis points\n- the string value \"auto\", where the server determines the maximum allowed slippage\n automatically"
required: false
schema:
$ref: '#/components/schemas/SlippageTolerance'
- name: perLegSlippage
in: query
description: 'If true or unspecified, per-leg slippage checks are enabled. If false, per-leg slippage
checks are disabled.'
required: false
schema:
type: boolean
- name: predictionMarketSlippageBps
in: query
description: "Max allowed slippage for prediction market orders. Allowed values are:\n- a u16 which specifies the maximum allowed slippage in basis points\n- the string value \"auto\", where the server determines the maximum allowed slippage\n automatically\n\nIf specified as a u16:\n - must be greater than or equal to `slippage_bps`\n - this value will be used as the slippage for prediction market orders\n\nIf unspecified or \"auto\":\n - the server determines the maximum allowed slippage for prediction market orders\n\nThis will be the slippage value included in the created Prediction Order. This parameter is\nnot used in routing, but only affects the minimum amount of Outcome mint that a prediction\norder must produce to fill successfully."
required: false
schema:
$ref: '#/components/schemas/SlippageTolerance'
- name: priceImpactTolerancePct
in: query
description: 'If specified, the API will return an error if the price impact of the route is greater than
the specified percentage. If unspecified, the server will determine the threshold. For
example, 10 is 10% and 100 is 100%.'
required: false
schema:
type: integer
format: int32
minimum: 0
- name: dexes
in: query
description: Comma-separated list of DEXes to include. If not specified, all DEXes will be included.
required: false
schema:
type: string
- name: excludeDexes
in: query
description: Comma-separated list of DEXes to exclude. If not specified, all DEXes will be included.
required: false
schema:
type: string
- name: onlyDirectRoutes
in: query
description: If true, only use single-leg routes
required: false
schema:
type: boolean
- name: maxRouteLength
in: query
description: 'If specified, the route will be limited to the specified number of legs. Ignored if
`only_direct_routes` is true.'
required: false
schema:
type: integer
format: int32
minimum: 0
- name: onlyJitRoutes
in: query
description: If true, only use JIT routes. Every leg in the route will use the JIT router.
required: false
schema:
type: boolean
- name: forJitoBundle
in: query
description: 'If true, only use routes that are compatible with Jito bundles. This should only be
specified as true if the swap will be executed in a Jito bundle. Default is false.'
required: false
schema:
type: boolean
- name: allowSyncExec
in: query
description: If true, allow synchronous execution. Default is true.
required: false
schema:
type: boolean
- name: allowAsyncExec
in: query
description: If true, allow asynchronous execution. Default is true.
required: false
schema:
type: boolean
- name: restrictRevertMint
in: query
description: 'If true, enforces that the input mint must be the revert mint for orders that use
asynchronous execution.
Default is false.'
required: false
schema:
type: boolean
- name: platformFeeMode
in: query
description: 'Optional platform fee mode. If not specified, the default is `outputMint`. For async
prediction market swaps, this is ignored, and the platform fee is paid in the stablecoin
mint.'
required: false
schema:
$ref: '#/components/schemas/PlatformFeeMode'
- name: platformFeeBps
in: query
description: 'Optional platform fee in basis points. This should only be nonzero if the swap will collect
the platform fee. The fee account must be able to collect the fee mint at execution time.'
required: false
schema:
type: integer
format: int32
minimum: 0
- name: platformFeeScale
in: query
description: 'Optional platform fee scale for native prediction market swaps and async prediction market
swaps, with 3 decimals. This should only be nonzero if the swap will collect the platform
fee. The fee account must be able to collect the fee mint at fill time. Must be
>= 0 and < 1000. For example, a value of 50 means 0.050.'
required: false
schema:
type: integer
format: int32
minimum: 0
- name: feeAccount
in: query
description: 'Base58-encoded address of the token account that will receive the platform fee if a platform
fee applies to the swap. If specified, this account''s mint must match the fee mint for the
swap. This must be specified if the platform fee is nonzero.'
required: false
schema:
type: string
- name: positiveSlippageFeeAccount
in: query
description: 'Base58-encoded address of the token account that will receive the positive slippage fee.
This must be a token account for the output mint, regardless of the platform fee mode. If at
swap execution time this account can''t receive the positive slippage fee, then the positive
slippage fee transfer is skipped. If the platform fee mode is `outputMint` and the platform
fee account is specified, then this must be unspecified (in which case the platform fee
account will be used) or match the platform fee account. Otherwise, this must be specified.'
required: false
schema:
type: string
- name: positiveSlippageLimitPct
in: query
description: 'Limit on the positive slippage fee in percent. The positive slippage fee is limited to the
lesser of (1) the excess actual out amount above the quoted amount and (2) this percentage
of the actual out amount after platform fee.'
required: false
schema:
type: integer
format: int32
minimum: 0
- name: sponsor
in: query
description: 'Base58-encoded address of the sponsor''s wallet. If specified, the sponsor will pay the
transaction fee and for token account creation, and both the user and the sponsor must sign
the swap transaction. This can be used to implement gasless swaps.
Cannot be specified alongside `predictionMarketInitPayer` parameter.'
required: false
schema:
type: string
- name: sponsorExec
in: query
description: 'If true, the sponsor will be the executor of the swap for sponsored swaps. If false, the
user will be the executor of the swap for sponsored swaps. Default is true.'
required: false
schema:
type: boolean
- name: destinationTokenAccount
in: query
description: 'Base58-encoded address of the account that will receive the output token. This is either the
address of the destination token account, or, if the output is native SOL, the address of
the destination wallet. If both `destinationTokenAccount` and `destinationWallet` are
unspecified, the user''s associated token account for the output mint will be used if the
output isn''t native SOL, and the user''s wallet will be used if the output is native SOL.
If the output isn''t native SOL, the specified account must exist before the swap executes,
or else the swap will fail.
Mutually exclusive with `destinationWallet`.'
required: false
schema:
type: string
- name: destinationWallet
in: query
description: "Base58-encoded address of the wallet that will receive the output token. Mutually exclusive\nwith `destinationTokenAccount`. If specified:\n1. If the swap outputs native SOL, the transaction will output native SOL to the specified\n wallet.\n2. If the swap outputs wrapped SOL or an SPL token, the transaction will send output to the\n specified wallet's associated token account for the output mint, creating the associated\n token account if it doesn't exist at execution time."
required: false
schema:
type: string
- name: outputCloseAuthority
in: query
description: 'Base58-encoded address of the close authority to assign to the output token account. If
specified, the swap instruction will idempotently initialize the output token account and
set its close authority to the specified address. The action is a no-op if the output
token account already exists at execution time.
Cannot be used when the output mint is SOL (wrapped or native). Cannot be used with
`destinationTokenAccount` or `destinationWallet`.'
required: false
schema:
type: string
- name: revertWallet
in: query
description: 'Base58-encoded address of the wallet that will receive the revert mint if the order is an
asynchronous order and it reverts.'
required: false
schema:
type: string
- name: wrapAndUnwrapSol
in: query
description: If false, the order will use wrapped SOL
required: false
schema:
type: boolean
- name: prioritizationFeeLamports
in: query
description: 'Prioritization fee in lamports. Mutually exclusive with `computeUnitPriceMicroLamports`.
If both `prioritizationFeeLamports` and `computeUnitPriceMicroLamports` are unspecified, the
default of `prioritizationFeeLamports="auto"` will be used.
Allowed values are:
- an unsigned 32-bit integer which specifies the prioritization fee in lamports
- the string value "auto", where the server determines the fee automatically
- the string value "medium", where the server determines the fee automatically
- the string value "high", where the server determines the fee automatically
- the string value "veryHigh", where the server determines the fee automatically
- the string value "disabled", where the server leaves the prioritization fee unspecified'
required: false
schema:
$ref: '#/components/schemas/OrderPrioritizationFeeLamports'
- name: prioritizationFeeMaxLamports
in: query
description: Maximum lamports to cap the prioritization fee determined by the server
required: false
schema:
type: integer
format: int32
minimum: 0
- name: computeUnitPriceMicroLamports
in: query
description: Compute unit price in micro-lamports. Mutually exclusive with `prioritizationFeeLamports`.
required: false
schema:
type: integer
format: int64
minimum: 0
- name: dynamicComputeUnitLimit
in: query
description: 'If true, the server will simulate the transaction to determine its compute unit limit. If
unspecified or false, the transaction will use the default compute unit limit.'
required: false
schema:
type: boolean
- name: includeJitoSandwichMitigationAccount
in: query
description: 'If specified, the transaction will include a Jito sandwich mitigation account in the swap
instruction. Allowed values are:
- `true` - uses the default Jito sandwich mitigation account
- `false` - does not include the account
- A base58-encoded account address - uses the specified account
If unspecified, the account is not included.
See https://docs.jito.wtf/lowlatencytxnsend/#sandwich-mitigation for more details.'
required: false
schema:
$ref: '#/components/schemas/IncludeJitoSandwichMitigationAccount'
- name: predictionMarketInitPayer
in: query
description: 'Base58-encoded address of the account that will pay for market initialization if the market
is uninitialized. If specified and the market is uninitialized, this account must sign the
transaction, and the transaction will initialize the market if it is uninitialized at
execution time. If this account differs from `userPublicKey`, the transaction will have
two signers.
Cannot be specified alongside `sponsor` parameter.'
required: false
schema:
type: string
- name: outcomeAccountRentRecipient
in: query
description: 'Base58-encoded address of the account that will receive the rent from closing the outcome
token account if it is empty after sale/redemption. If unspecified, the user''s public key
will be used.'
required: false
schema:
type: string
- name: skipPumpfunCashbackClaim
in: query
description: 'If true, Pump.fun cashback will not be claimed for cashback-eligible coins. When set, sell
quotes include the full creator fee, and execution skips Pump.fun cashback claiming. Default
is false. Cannot be used with sponsor-executed swaps (`sponsorExec` is true or defaulted to
true).'
required: false
schema:
type: boolean
- name: allowBondingCurveUnderconsumption
in: query
description: 'If true, allow buys on bonding curves to succeed even when the bonding curve cannot fully
consume the input (for example, when the curve is near completion). Default is false. Cannot
be used with sponsor-executed swaps (`sponsorExec` is true or defaulted to true).'
required: false
schema:
type: boolean
- name: includeAddressLookupTables
in: query
description: 'If true, the response will include the address lookup tables used in the transaction,
with only the entries referenced by the transaction, enabling clients to deserialize and
recompile the transaction with additional instructions without fetching ALTs from RPC.
Default is false.'
required: false
schema:
type: boolean
- name: maxAccounts
in: query
description: 'Maximum allowed number of accounts that the transaction can use. Mutually exclusive with
`reserveAccounts`.'
required: false
schema:
type: integer
format: int32
minimum: 0
- name: maxTransactionSize
in: query
description: 'Maximum allowed size of the transaction in bytes. Mutually exclusive with
`reserveTransactionSize`.'
required: false
schema:
type: integer
format: int32
minimum: 0
- name: reserveAccounts
in: query
description: 'Number of accounts to leave unused in the transaction. The server will ensure that
the transaction uses at most `TRANSACTION_MAX_ACCOUNTS - reserveAccounts` accounts. Mutually
exclusive with `maxAccounts`. If you add instructions to the transaction, use this parameter
to specify the number of unique accounts that you will add to the transaction. Note that you
should not count accounts that are already included in the transaction.'
required: false
schema:
type: integer
format: int32
minimum: 0
- name: reserveTransactionSize
in: query
description: 'Number of bytes to leave unused in the transaction. The server will ensure that the
transaction size is at most `TRANSACTION_MAX_SIZE - reserveTransactionSize` bytes. Mutually
exclusive with `maxTransactionSize`. If you add instructions to the transaction, use this
parameter to specify the number of bytes that your modifications will add to the
transaction.'
required: false
schema:
type: integer
format: int32
minimum: 0
responses:
'200':
description: Order response
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/OrderBadRequestResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/OrderInternalServerErrorResponse'
'503':
description: Service unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/OrderServiceUnavailableResponse'
/order-status:
get:
tags:
- order
summary: Returns the status of an order. Only prediction market orders are supported.
operationId: order_status_handler
parameters:
- name: signature
in: query
description: 'Base58-encoded transaction signature of the transaction received from the order endpoint.
Only prediction market order signatures are supported.'
required: true
schema:
type: string
- name: lastValidBlockHeight
in: query
description: Last block height at which the transaction is valid
required: false
schema:
type:
- integer
- 'null'
format: int64
minimum: 0
responses:
'200':
description: Order status
content:
application/json:
schema:
$ref: '#/components/schemas/OrderStatusResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/OrderStatusBadRequestResponse'
'404':
description: Order not found
content:
application/json:
schema:
$ref: '#/components/schemas/OrderStatusNotFoundResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/OrderStatusInternalServerErrorResponse'
components:
schemas:
DynamicRoutePlanLeg:
type: object
required:
- venue
- marketKey
- data
- inputMint
- outputMint
- inAmount
- outAmount
- inputMintDecimals
- outputMintDecimals
properties:
data:
type: string
description: Data for the leg
inAmount:
type: string
description: Maximum input amount for the leg as a scaled integer. For example, 1 SOL is 1000000000.
inputMint:
type: string
description: Base58-encoded input mint address
inputMintDecimals:
type: integer
format: int32
description: Decimals for the input mint
minimum: 0
marketKey:
type: string
description: Key identifying the market on the venue
outAmount:
type: string
description: Expected output amount for the leg as a scaled integer. For example, 1 SOL is 1000000000.
outputMint:
type: string
description: Base58-encoded output mint address
outputMintDecimals:
type: integer
format: int32
description: Decimals for the output mint
minimum: 0
venue:
type: string
description: Venue for the leg
Revert:
type: object
required:
- signature
- mint
- amount
properties:
amount:
type: string
description: Amount returned to the user, as a scaled integer. For example, 1 SOL is 1000000000.
mint:
type: string
description: Mint returned to the user
signature:
type: string
description: Base58-encoded signature of the revert transaction
OrderStatusInternalServerErrorCode:
type: string
enum:
- internal_server_error
OrderStatusBadRequestCode:
type: string
enum:
- invalid_signature
IncludeJitoSandwichMitigationAccount:
oneOf:
- type: boolean
- type: string
PrioritizationType:
oneOf:
- type: object
description: Prioritization fee specified via the compute budget program
required:
- computeBudget
properties:
computeBudget:
type: object
description: Prioritization fee specified via the compute budget program
required:
- microLamports
properties:
estimatedMicroLamports:
type:
- integer
- 'null'
format: int64
description: Compute unit price estimated by the server for the transaction
minimum: 0
microLamports:
type: integer
format: int64
description: Compute unit price assigned to the transaction
minimum: 0
ExecutionMode:
type: string
enum:
- sync
- async
OrderBadRequestCode:
type: string
enum:
- invalid_user_public_key
- invalid_sponsor
- invalid_revert_wallet
- invalid_prediction_market_init_payer
- requested_input_amount_is_zero
- invalid_input_mint
- invalid_output_mint
- same_input_and_output_mint
- invalid_slippage_bps
- prediction_slippage_bps_above_max
- prediction_slippage_bps_below_routing_slippage
- invalid_platform_fee_bps
- invalid_platform_fee_scale
- invalid_fee_account
- platform_fee_account_not_specified
- platform_fee_account_not_specified_for_platform_fee_scale
- invalid_positive_slippage_fee_account
- cannot_disable_sync_and_async_execution
- invalid_dex
- invalid_max_route_length_for_jit_route
- cannot_exclude_jit_router_for_jit_route
- route_not_found
- zero_out_amount
- price_impact_too_high
- both_priority_fee_params_specified
- both_destination_params_specified
- both_sponsor_and_prediction_market_init_payer_specified
- invalid_destination_token_account
- invalid_destination_wallet
- destination_token_account_not_supported
- invalid_output_close_authority
- output_close_authority_with_native_sol_output
- output_close_authority_with_destination_token_account
- invalid_input_mint_for_restrict_revert_mint
- invalid_jito_sandwich_mitigation_account
- invalid_outcome_account_rent_recipient
- unverified_wallet_not_allowed
- unsupported_prediction_market_sponsor_mode
- invalid_price_impact_tolerance_pct
- skip_pumpfun_cashback_claim_with_sponsor_executor
- allow_bonding_curve_underconsumption_with_sponsor_executor
- both_max_accounts_and_reserve_accounts_specified
- both_max_transaction_size_and_reserve_transaction_size_specified
- max_accounts_too_small
- max_transaction_size_too_small
- reserve_accounts_too_large
- reserve_transaction_size_too_large
OrderStatusResponse:
type: object
required:
- status
- inAmount
- outAmount
properties:
fills:
type: array
items:
$ref: '#/components/schemas/Fill'
description: Fills for the order. Specified if and only if the order has at least one fill.
inAmount:
type: string
description: Total input amount filled, as a scaled integer. For example, 1 SOL is 1000000000.
outAmount:
type: string
description: Total output amount filled, as a scaled integer. For example, 1 SOL is 1000000000.
reverts:
type: array
items:
$ref: '#/components/schemas/Revert'
description: Reverts for the order. Specified if and only if the order has at least one revert.
status:
$ref: '#/components/schemas/OrderStatus'
description: Status of the order
OrderServiceUnavailableResponse:
type: object
required:
- msg
- code
properties:
code:
$ref: '#/components/schemas/OrderServiceUnavailableCode'
msg:
type: string
example:
code: <enum<string>>
msg: <string>
AddressLookupTableResponse:
type: object
required:
- address
- addresses
properties:
address:
type: string
description: Base58-encoded address of the lookup table account
addresses:
type: object
description: 'Map of index to base58-encoded address for each entry in the lookup table that is used by
the transaction. Key is the index of the address in the lookup table and value is the
address.'
additionalProperties:
type: string
propertyNames:
type: integer
minimum: 0
SlippageTolerance:
oneOf:
- type: integer
format: int32
description: Slippage tolerance specified in basis points
minimum: 0
- type: string
description: Slippage tolerance will be determined by the server
enum:
- auto
OrderBadRequestResponse:
type: object
required:
- msg
- code
properties:
code:
$ref: '#/components/schemas/OrderBadRequestCode'
msg:
type: string
example:
code: <enum<string>>
msg: <string>
OrderInternalServerErrorCode:
type: string
enum:
- failed_to_compute_route
- failed_to_construct_order
RoutePlanLeg:
oneOf:
- $ref: '#/components/schemas/DynamicRoutePlanLeg'
- $ref: '#/components/schemas/SingleMarketRoutePlanLeg'
OrderStatusNotFoundResponse:
type: object
required:
- msg
- code
properties:
code:
$ref: '#/components/schemas/OrderStatusNotFoundCode'
msg:
type: string
example:
code: <enum<string>>
msg: <string>
Fill:
type: object
required:
- signature
- inputMint
- inAmount
- outputMint
- outAmount
properties:
inAmount:
type: string
description: Input amount including fees, as a scaled integer. For example, 1 SOL is 1000000000.
inputMint:
type: string
description: Input mint for the fill
outAmount:
type: string
description: Output amount including fees, as a scaled integer. For example, 1 SOL is 1000000000.
outputMint:
type: string
description: Output mint for the fill
signature:
type: string
description: Base58-encoded signature of the fill transaction
OrderPrioritizationFeeLamports:
oneOf:
- type: string
enum:
- auto
- medium
- high
- veryHigh
- disabled
- type: integer
format: int32
minimum: 0
OrderStatusInternalServerErrorResponse:
type: object
required:
- msg
- code
properties:
code:
$ref: '#/components/schemas/OrderStatusInternalServerErrorCode'
msg:
type: string
example:
code: <enum<string>>
msg: <string>
OrderServiceUnavailableCode:
type: string
enum:
- amm_map_not_initialized
- amm_map_lagging
OrderStatusNotFoundCode:
type: string
enum:
- not_found
PlatformFeeMode:
type: string
enum:
- outputMint
- inputMint
OrderInternalServerErrorResponse:
type: object
required:
- msg
- code
properties:
code:
$ref: '#/components/schemas/OrderInternalServerErrorCode'
msg:
type: string
example:
code: <enum<string>>
msg: <string>
OrderResponse:
type: object
required:
- inputMint
- inAmount
- outputMint
- outAmount
- otherAmountThreshold
- minOutAmount
- slippageBps
- priceImpactPct
- contextSlot
- executionMode
properties:
addressLookupTables:
type: array
items:
$ref: '#/components/schemas/AddressLookupTableResponse'
description: 'Address lookup tables used in the transaction. Each entry contains the table''s address and
a map of index to address for each entry in the table that is used by the transaction.
Specified if and only if the request included `includeAddressLookupTables=true` and the
request included the user''s public key.'
computeUnitLimit:
type: integer
format: int32
description: 'Compute unit limit assigned to the transaction. Specified if and only if the request included
the user''s public key.'
minimum: 0
contextSlot:
type: integer
format: int64
description: Slot at which the request was evaluated
minimum: 0
executionMode:
$ref: '#/components/schemas/ExecutionMode'
description: Order execution mode
inAmount:
type: string
description: Maximum input amount as a scaled integer. For example, 1 SOL is 1000000000.
initPredictionMarketCost:
type: integer
format: int32
description: 'Cost in lamports to initialize a prediction market. Specified if and only if the transaction
will initialize the prediction market.'
minimum: 0
inputMint:
type: string
description: Base58-encoded input mint address
isNativePredictionMarketOutput:
type: boolean
description: True if and only if the output mint is a native prediction market outcome mint.
lastValidBlockHeight:
type: integer
format: int64
description: 'The last block height
# --- truncated at 32 KB (37 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/dflow/refs/heads/main/openapi/dflow-order-api-openapi.yml