curl --request POST \
--url https://testnet.edel-api.xyz/v2/orders/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "{{accountId}}",
"marketId": "{{marketId}}",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "100000",
"priceAtoms": "6500000"
}
'import requests
url = "https://testnet.edel-api.xyz/v2/orders/preview"
payload = {
"accountId": "{{accountId}}",
"marketId": "{{marketId}}",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "100000",
"priceAtoms": "6500000"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: '{{accountId}}',
marketId: '{{marketId}}',
side: 'buy',
orderType: 'limit',
quantityAtoms: '100000',
priceAtoms: '6500000'
})
};
fetch('https://testnet.edel-api.xyz/v2/orders/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));use reqwest::blocking::Client;
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = Client::new()
.post("https://testnet.edel-api.xyz/v2/orders/preview")
.bearer_auth(std::env::var("EDEL_API_KEY")?)
.json(&json!({
"accountId": "{{accountId}}",
"marketId": "{{marketId}}",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "100000",
"priceAtoms": "6500000"
}))
.send()?;
println!("{} {}", response.status(), response.text()?);
Ok(())
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://testnet.edel-api.xyz/v2/orders/preview"
payload := strings.NewReader("{\n \"accountId\": \"{{accountId}}\",\n \"marketId\": \"{{marketId}}\",\n \"side\": \"buy\",\n \"orderType\": \"limit\",\n \"quantityAtoms\": \"100000\",\n \"priceAtoms\": \"6500000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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(string(body))
}HttpResponse<String> response = Unirest.post("https://testnet.edel-api.xyz/v2/orders/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"{{accountId}}\",\n \"marketId\": \"{{marketId}}\",\n \"side\": \"buy\",\n \"orderType\": \"limit\",\n \"quantityAtoms\": \"100000\",\n \"priceAtoms\": \"6500000\"\n}")
.asString();{
"version": "external-order-preview/v1",
"accountId": "<string>",
"marketId": "<string>",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "<string>",
"quantity": "<string>",
"notionalAtoms": "<string>",
"notional": "<string>",
"estimatedEntryPriceAtoms": "<string>",
"estimatedEntryPrice": "<string>",
"estimatedSlippageBps": 1,
"wouldExceedMaxSlippage": true,
"requiredMarginAtoms": "<string>",
"requiredMargin": "<string>",
"estimatedFeeAtoms": "<string>",
"estimatedFee": "<string>",
"feeRole": "maker",
"estimatedLiquidationPriceAtoms": "<string>",
"estimatedLiquidationPrice": "<string>",
"maintenanceMarginBps": 1,
"availableForOrdersAtoms": "<string>",
"availableForOrders": "<string>",
"sufficient": true,
"asOf": {
"markPriceAtoms": "<string>",
"markPrice": "<string>",
"journalSequence": 1
}
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}Preview an order (v2)
Computes estimated entry price, slippage, margin, fees, and liquidation price without reserving or journaling state. The preview meets the same KYC, order intake and agent checks a placement meets. On a spot market the preview is the placement itself run in a dry mode: the engine decides the same command on its current state and writes nothing, so the answer is the placement’s answer. A spot order the placement would refuse answers that refusal by name (for example 409 insufficient_balance, market_halted or invalid_price); requiredMargin is what the order would lock (quote for a buy, base for a sell), the mark is null and there is no liquidation price. Send clientOrderId to be decided for that id; without it the preview assumes the longest id allowed.
curl --request POST \
--url https://testnet.edel-api.xyz/v2/orders/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "{{accountId}}",
"marketId": "{{marketId}}",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "100000",
"priceAtoms": "6500000"
}
'import requests
url = "https://testnet.edel-api.xyz/v2/orders/preview"
payload = {
"accountId": "{{accountId}}",
"marketId": "{{marketId}}",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "100000",
"priceAtoms": "6500000"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: '{{accountId}}',
marketId: '{{marketId}}',
side: 'buy',
orderType: 'limit',
quantityAtoms: '100000',
priceAtoms: '6500000'
})
};
fetch('https://testnet.edel-api.xyz/v2/orders/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));use reqwest::blocking::Client;
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = Client::new()
.post("https://testnet.edel-api.xyz/v2/orders/preview")
.bearer_auth(std::env::var("EDEL_API_KEY")?)
.json(&json!({
"accountId": "{{accountId}}",
"marketId": "{{marketId}}",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "100000",
"priceAtoms": "6500000"
}))
.send()?;
println!("{} {}", response.status(), response.text()?);
Ok(())
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://testnet.edel-api.xyz/v2/orders/preview"
payload := strings.NewReader("{\n \"accountId\": \"{{accountId}}\",\n \"marketId\": \"{{marketId}}\",\n \"side\": \"buy\",\n \"orderType\": \"limit\",\n \"quantityAtoms\": \"100000\",\n \"priceAtoms\": \"6500000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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(string(body))
}HttpResponse<String> response = Unirest.post("https://testnet.edel-api.xyz/v2/orders/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"{{accountId}}\",\n \"marketId\": \"{{marketId}}\",\n \"side\": \"buy\",\n \"orderType\": \"limit\",\n \"quantityAtoms\": \"100000\",\n \"priceAtoms\": \"6500000\"\n}")
.asString();{
"version": "external-order-preview/v1",
"accountId": "<string>",
"marketId": "<string>",
"side": "buy",
"orderType": "limit",
"quantityAtoms": "<string>",
"quantity": "<string>",
"notionalAtoms": "<string>",
"notional": "<string>",
"estimatedEntryPriceAtoms": "<string>",
"estimatedEntryPrice": "<string>",
"estimatedSlippageBps": 1,
"wouldExceedMaxSlippage": true,
"requiredMarginAtoms": "<string>",
"requiredMargin": "<string>",
"estimatedFeeAtoms": "<string>",
"estimatedFee": "<string>",
"feeRole": "maker",
"estimatedLiquidationPriceAtoms": "<string>",
"estimatedLiquidationPrice": "<string>",
"maintenanceMarginBps": 1,
"availableForOrdersAtoms": "<string>",
"availableForOrders": "<string>",
"sufficient": true,
"asOf": {
"markPriceAtoms": "<string>",
"markPrice": "<string>",
"journalSequence": 1
}
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "promo_code_unknown",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"featureFlag": "<string>",
"orderOutcome": "not_submitted",
"clientOrderIds": [
"<string>"
],
"reconciliation": "<string>",
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "custodial_signer_environment_not_service_held",
"withdrawalFailure": "requested",
"feeShareAcceptRefusal": "challenge_missing",
"dependency": "dfns",
"squidRouteRefusal": "route_not_found",
"positionSnapshotRefusal": "position_projection_behind_live",
"setupKeyRefusal": "setup_key_refused"
}Authorizations
The authorization field takes the session bearer returned by sign-in, or an API key where the route allows keys. Paste the token itself into the authorization field. When invitation-only access is enabled, private operations require the account's sign-in email to be invited. Sign-in can complete without an invitation, but private HTTP, MCP and FIX operations refuse with access_not_allowlisted (HTTP 403): "Private access is limited to invited accounts. Contact support to request access." Public market data remains available. Invitation changes apply to the next private operation, including existing FIX sessions. Do not retry until support confirms access.
Body
- Option 1
- Option 2
Spot only: the clientOrderId the order would be placed with, under the same rules as placement (a reserved id is refused with HTTP 400, as placement refuses it). A spot preview runs the placement itself in a dry mode, so its verdict is the placement's for the same id. Without it the preview assumes a 256-character id, the longest allowed: at the engine's record size limit (a taker that would fill very many makers) it may refuse an order that the same placement with a shorter id would accept.
1 - 256^(?:[A-Za-z0-9._:-]+|bot-order\/v1:(?:sha256:)?[a-f0-9]{64})$Response
Success