Skip to main content
Use this guide to apply broker-scoped custom trading fees to individual orders.
API base URL: https://api.orderly.org (mainnet) or https://testnet-api.orderly.org (testnet)New-order tag format: enum:<owning_broker_id>:<enum_id>Authentication: Public discovery endpoints are unauthenticated. Broker admin endpoints require Orderly Ed25519 signature headers.

Overview

A custom trading fee configuration is a broker-owned order classification with an additional fee rate. A DEX can attach the configuration to an order for strategy, vault, campaign, bot, or other product-specific flows. The current tag format separates two identities: The configuration key is {fee-owning broker, enum_id}. enum_id is not globally unique. For example, these tags select different fee configurations:
With the current format, order_enum_fee is always separated from builder and affiliate fee-share calculations, including when the fee owner and executing broker are the same.

Legacy and current tag formats

Quick Start

1

Discover the owner's fee configuration

Query the public list with the fee owner’s broker ID:
Select an active configuration from the response. API objects contain an unprefixed enum_id, such as GRID_PRO.See GET /v1/public/broker/order_enums.
2

Build the order tag

Combine the owner from the query with the returned enum_id:
Do not use the executing broker’s ID unless it also owns the selected configuration.
3

Submit the order

Use the normal signing procedure for the order endpoint. Signature construction is outside this guide.
4

Verify the execution

Read the order and trade records after execution:
  • Confirm the order returns the full order_tag without truncation.
  • Confirm each trade exposes order_enum_fee separately.
  • Use trade-level values, not order estimates, for statements and reconciliation.

Order Tag Contract

Syntax

All new custom-fee-tagged orders use exactly three colon-separated segments:
Valid examples:
Invalid examples:

Build tags defensively

The following TypeScript helper enforces the current client-side contract:
Validate again at the service boundary. A browser-only validator does not protect backend, bot, or direct API integrations.

Referral-code behavior

A plain order_tag, such as REFERRAL2026, remains a referral-code flow. An enum: tag identifies a custom trading fee configuration and does not replace the account’s existing referral relationship. The custom trading fee is not part of referral-eligible fee revenue. Do not add order_enum_fee to an affiliate or executing-builder commission base.

Legacy tags

Do not send enum:<enum_id> on a new order after the current format is enabled. The platform retains legacy parsing only so orders accepted before cutover can continue to fill, charge, and update owner statistics. When reading historical legacy records, resolve the fee owner to the executing broker. Do not rewrite stored legacy tags.

Discover Custom Fee Configurations

Discovery APIs return unprefixed enum_id values. The caller combines the queried owner broker ID and returned enum_id to construct the full order_tag.

List configurations for an owner

Use GET /v1/public/broker/order_enums. This endpoint is unauthenticated and limited to 10 requests per second per IP address.
Example response:
For this response, construct:
If a pair override exists for the order symbol, it is the applicable custom fee rate. Otherwise, use default_fee_rate for fee disclosure. Cache public responses briefly, but treat order acceptance and trade results as authoritative. Do not use an archived configuration for new orders.

Get one configuration

Use GET /v1/public/broker/order_enum. This endpoint is unauthenticated.
The response uses the same configuration object as the list endpoint and does not include usage statistics.

Apply a Custom Fee to an Order

Set the optional order_tag field to the complete current-format tag. order_tag has a 128-character transport and storage capacity. It cannot be changed after order acceptance. Cancel and replace the order if the tag must change.

Single order

Batch order

Each item is independent. Validate and assign the intended owner and configuration for every tagged item rather than copying a batch-level value implicitly.

Algo order

Submission behavior

Before submitting, verify that:
  1. The configuration was discovered under the same owner encoded in the tag.
  2. The configuration is active.
  3. The symbol and fee configuration are suitable for the order.
  4. The full tag passes the validation rules above and is not truncated by an SDK, database, queue, or log field.
Always handle a rejected order. Public discovery is useful for configuration and display, but the order API is the final authority at submission time.

Fee and Settlement Behavior

The custom trading fee is an additional per-execution fee:
Display the custom trading fee separately from the standard trading fee before submission when the UI has enough information to estimate it. Use actual trade records for final amounts.

Economic ownership

Do not calculate builder, partner, or affiliate payouts from raw fee or total_fee. Start from explicit eligible components or subtract order_enum_fee as defined by the settlement contract.

Signed maker settlement

Financial reconciliation must use the signed fee rate after subtracting the custom fee for the maker branch:
Do not subtract a negative baseMakerFee from effectiveTradeFee to manufacture positive builder or affiliate revenue.

Read and Reconcile Results

Order-level data

Order query APIs return the full order_tag. Use it for attribution and UI display. Order-level total_fee includes custom trading fees accumulated across executed trades. It is an aggregate display value, not a payout basis.

Trade-level data

Trade query APIs return per-execution fee, order_enum_fee, and order_enum_fee_rate.
Use trade-level records for statements, fee reconciliation, settlement verification, and finance reporting because fee calculation occurs per execution.

Resolve attribution

For a trade using the current tag format:
  • Read the executing broker from the order or execution context.
  • Parse the fee-owning broker and enum_id from the full order_tag.
  • Classify the fill as same-builder when the two broker IDs match, otherwise cross-builder.
For a historical legacy trade, resolve the owner to the executing broker.

Usage statistics

The broker admin APIs aggregate usage by {fee-owning broker, enum_id}. Cross-builder activity therefore appears in the owner’s totals. The aggregate does not split statistics by executing broker. Use durable order and trade data when a report needs executing-broker, same-builder, or cross-builder dimensions.

Manage Custom Fee Configurations

Call admin endpoints only from secured broker backend or admin tooling. Never expose signing keys in a DEX frontend. All configuration management APIs use an unprefixed enum_id. They do not accept the full enum:<broker_id>:<enum_id> tag.

Create a configuration

Use POST /v1/broker/order_enum. This authenticated endpoint is limited to one request per second.
The default limit is 10 active configurations per owning broker and is deployment-configurable. Existing configurations share the same pool regardless of which tag format historical orders used.

Update a configuration

Use PUT /v1/broker/order_enum/{enum_id}. This authenticated endpoint is limited to one request per second. The configuration must be active, and enum_id cannot change.
For pair_overrides:
  • Omit it or send null to leave existing overrides unchanged.
  • Send an empty object to remove every override.
  • Send a non-empty object to replace the existing override set.

List or get owned configurations

Use GET /v1/broker/order_enums or GET /v1/broker/order_enum/{enum_id}. The authenticated responses include the fee configuration and owner-aggregated usage statistics:

Archive a configuration

Use POST /v1/broker/order_enum/archive. This authenticated endpoint is limited to one request per second.
Do not use an archived configuration for new orders. Historical order and trade attribution remains available.

Unarchive a configuration

Use POST /v1/broker/order_enum/unarchive. This authenticated endpoint is limited to one request per second.
A configuration can be unarchived only during the configured retention period and only if restoring it does not exceed the active-configuration limit. The default retention period is 720 hours (30 days). After that, the daily purge job moves it to PURGED and it cannot be restored.

Authentication and Rate Limits

Admin request headers

Public discovery endpoints do not require these headers.

Documented limits

Apply exponential backoff for 429 responses and cache public discovery results to avoid unnecessary requests.

Migrate a Legacy Integration

The current format reuses existing fee configurations. Migration changes the tag that clients send; it does not duplicate configuration rows.

Before cutover

  1. Change tag construction from enum:<enum_id> to enum:<owning_broker_id>:<enum_id>.
  2. Update all client, server, SDK, schema, event, log, and analytics fields that carry a full order_tag from 36 to 128 characters.
  3. Update enum_id validation from 31 to 36 characters.
  4. Continue reading both legacy and current tags in order history and execution consumers.
  5. Resolve historical legacy ownership to the executing broker and current ownership from the tag.
  6. Update reconciliation so every order_enum_fee is excluded from affiliate and executing-builder fee-share bases.
  7. Test one same-builder and one cross-builder fill end to end.

At cutover

  • Stop submitting V1 tags on new orders.
  • Monitor rejection rates for malformed or truncated current-format tags.
  • Verify order_enum_fee and order_enum_fee_rate are populated on actual trades.
  • Verify the full tag survives order, execution, settlement, archive, and reporting paths.

Historical behavior

Orders accepted with V1 tags before cutover continue to fill under V1 tag parsing. Do not rewrite those tags. Fees already settled before the current settlement behavior was enabled are not recalculated or redistributed. Reports should preserve the rule that applied at execution time.

Troubleshooting

New orders fail after cutover

Check whether the integration still sends enum:<enum_id>. New orders require the owner segment:

A fee configuration cannot be resolved

Confirm that the tag’s owner matches the broker_id used to discover the configuration. The same enum_id under another broker identifies a different configuration.

The tag is truncated

Search every hop for the old 36-character limit. The source order field must be widened before downstream widening can preserve the value. Validate the returned order tag byte-for-byte against the submitted value.

The custom fee differs from the displayed estimate

Check the pair override for the executed symbol and use per-trade values for final reconciliation. Partial fills can produce multiple fee records.

Usage totals do not split by executing broker

This is expected. Admin usage statistics aggregate by fee owner and enum_id. Build executing-broker reports from order and trade facts.

Admin API returns a configuration error

Order-submission validation errors may use a different order API error contract. Preserve and log the complete response rather than mapping every failure to “configuration not found.”

Integration Checklist

  • Public discovery queries the fee-owning broker, not automatically the executing broker.
  • New tags use enum:<owning_broker_id>:<enum_id>.
  • Prefix, segment, character, and length rules are validated server-side.
  • Every full-tag field supports 128 characters.
  • Public API enum_id values remain unprefixed in application state.
  • The DEX shows the custom trading fee separately from the standard trading fee when estimating charges.
  • Order rejection is handled without silently retrying with a different tag.
  • Order responses preserve the submitted full tag.
  • Trade reconciliation uses fee and order_enum_fee per execution.
  • Affiliate and builder payout calculations exclude the full custom trading fee.
  • Historical readers support legacy and current tags without rewriting legacy data.
  • Admin endpoints and signing keys remain backend-only.
  • Same-builder, cross-builder, partial-fill, malformed-tag, archived-configuration, and maximum-length cases are tested.
Last updated: July 21, 2026.