# Limit Orders

## Place a new limit order

> Place a conditional order that triggers automatically when a token reaches a target price. Supports limit buys (buy + lte), stop losses (sell + lte), take profits (sell + gte), and breakout buys (buy + gte). Balances are checked at fill time only — no escrow. A company stack is auto-created for the token if one does not exist. DFlow-only tokens are auto-detected and routed accordingly.\
> \*\*Limits\*\*: 20 active orders per user, 1 active order per token per user, minimum buy amount 1 USDC.

```json
{"openapi":"3.0.3","info":{"title":"Indexify API","version":"0.1.12-beta"},"servers":[{"url":"https://api.indexify.finance","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key with the `ix_` prefix. You can generate an API Key by navigating to Settings -> API Key in the web app. Pass it in the `X-API-KEY` header on every request."}},"schemas":{"LimitOrderPlaceResponse":{"type":"object","description":"Subset of limit order fields returned by the place action. Does not include token metadata or display fields.","properties":{"order_id":{"type":"string","description":"16-character unique order identifier"},"status":{"type":"string","enum":["ACTIVE"]},"token_address":{"type":"string","description":"Solana token mint address"},"side":{"type":"string","enum":["buy","sell"]},"condition_type":{"type":"string","enum":["lte","gte"]},"trigger_price":{"type":"number","description":"Target USD price threshold"},"amount":{"type":"number","description":"For buys: USDC amount. For sells: percentage (0-100)"},"stack_id":{"type":"integer","description":"Company stack ID used for the trade"},"swap_provider":{"type":"string","enum":["jupiter","dflow"]},"created_at":{"type":"integer","description":"Unix timestamp of order creation"},"expires_at":{"type":"integer","nullable":true,"description":"Unix timestamp for automatic expiration, or null if no expiry"}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}},"paths":{"/api/limit_orders.php?action=place":{"post":{"operationId":"limitOrderPlace","summary":"Place a new limit order","description":"Place a conditional order that triggers automatically when a token reaches a target price. Supports limit buys (buy + lte), stop losses (sell + lte), take profits (sell + gte), and breakout buys (buy + gte). Balances are checked at fill time only — no escrow. A company stack is auto-created for the token if one does not exist. DFlow-only tokens are auto-detected and routed accordingly.\n**Limits**: 20 active orders per user, 1 active order per token per user, minimum buy amount 1 USDC.","tags":["Limit Orders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token_address","side","condition_type","trigger_price","amount"],"properties":{"token_address":{"type":"string","description":"Solana token mint address"},"side":{"type":"string","enum":["buy","sell"],"description":"Order direction. \"buy\" purchases the token with USDC, \"sell\" sells existing holdings"},"condition_type":{"type":"string","enum":["lte","gte"],"description":"Price comparison. \"lte\" triggers when price <= target, \"gte\" triggers when price >= target"},"trigger_price":{"type":"number","description":"USD price threshold that triggers the order. Must be > 0"},"amount":{"type":"number","description":"For buys: USDC amount (minimum 1 USDC). For sells: percentage of holdings (0-100)"},"expires_at":{"type":"integer","nullable":true,"description":"Optional unix timestamp for order expiration. Must be in the future. Omit for no expiry"}}}}}},"responses":{"200":{"description":"Order placed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LimitOrderPlaceResponse"}}}},"400":{"description":"Validation error — missing/invalid fields, minimum amount not met, invalid percentage, archived token with buy side, or invalid expires_at.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Token not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Per-user limit reached (20 active orders) or per-token limit reached (1 active order per token).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Cancel an active limit order

> Cancel a limit order that has not yet been triggered. Only orders in ACTIVE status can be cancelled. Orders in TRIGGERED, FILLING, FILLED, FAILED, or CANCELLED status cannot be cancelled. The order is removed from both the database and Redis.

```json
{"openapi":"3.0.3","info":{"title":"Indexify API","version":"0.1.12-beta"},"servers":[{"url":"https://api.indexify.finance","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key with the `ix_` prefix. You can generate an API Key by navigating to Settings -> API Key in the web app. Pass it in the `X-API-KEY` header on every request."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}},"paths":{"/api/limit_orders.php?action=cancel":{"post":{"operationId":"limitOrderCancel","summary":"Cancel an active limit order","description":"Cancel a limit order that has not yet been triggered. Only orders in ACTIVE status can be cancelled. Orders in TRIGGERED, FILLING, FILLED, FAILED, or CANCELLED status cannot be cancelled. The order is removed from both the database and Redis.","tags":["Limit Orders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["order_id"],"properties":{"order_id":{"type":"string","description":"The 16-character limit order ID to cancel"}}}}}},"responses":{"200":{"description":"Order cancelled successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"order_id":{"type":"string"},"status":{"type":"string"}}}}}},"400":{"description":"Order is not in ACTIVE status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Order not found or does not belong to the authenticated user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## List user's limit orders

> Returns all limit orders for the authenticated user, ordered by creation time (newest first). Supports optional filtering by status and/or token address. Returns an empty array if no orders match.

```json
{"openapi":"3.0.3","info":{"title":"Indexify API","version":"0.1.12-beta"},"servers":[{"url":"https://api.indexify.finance","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key with the `ix_` prefix. You can generate an API Key by navigating to Settings -> API Key in the web app. Pass it in the `X-API-KEY` header on every request."}},"schemas":{"LimitOrder":{"type":"object","description":"Full limit order object returned by list and get actions. Includes token metadata and display fields.","properties":{"order_id":{"type":"string","description":"16-character unique order identifier"},"token_address":{"type":"string","description":"Solana token mint address"},"token_symbol":{"type":"string","nullable":true,"description":"Token ticker symbol"},"token_name":{"type":"string","nullable":true,"description":"Token display name"},"token_image":{"type":"string","nullable":true,"description":"Token logo URL"},"side":{"type":"string","enum":["buy","sell"],"description":"Order direction"},"condition_type":{"type":"string","enum":["lte","gte"],"description":"\"lte\" triggers when price <= target, \"gte\" triggers when price >= target"},"trigger_price":{"type":"number","description":"Target USD price threshold"},"amount":{"type":"number","description":"For buys: USDC amount. For sells: percentage of holdings (0-100)"},"amount_display":{"type":"string","description":"Human-readable amount — \"$50.00\" for buys, \"50%\" for sells"},"status":{"type":"string","enum":["ACTIVE","TRIGGERED","FILLING","FILLED","FAILED","CANCELLED"],"description":"Current lifecycle status"},"stack_id":{"type":"integer","description":"Company stack ID used for the trade"},"swap_provider":{"type":"string","enum":["jupiter","dflow"],"description":"Swap provider used for execution"},"created_at":{"type":"integer","description":"Unix timestamp of order creation"},"updated_at":{"type":"integer","nullable":true,"description":"Unix timestamp of last status change"},"triggered_at":{"type":"integer","nullable":true,"description":"Unix timestamp when the price condition was met"},"triggered_price":{"type":"number","nullable":true,"description":"Actual USD price that triggered the order"},"filled_at":{"type":"integer","nullable":true,"description":"Unix timestamp when the fill completed"},"fill_order_id":{"type":"string","nullable":true,"description":"Linked stack_orders.order_id for the fill"},"error_message":{"type":"string","nullable":true,"description":"Failure reason (only present when status is FAILED)"},"expires_at":{"type":"integer","nullable":true,"description":"Unix timestamp for automatic expiration, or null if no expiry"}}}}},"paths":{"/api/limit_orders.php?action=list":{"get":{"operationId":"limitOrderList","summary":"List user's limit orders","description":"Returns all limit orders for the authenticated user, ordered by creation time (newest first). Supports optional filtering by status and/or token address. Returns an empty array if no orders match.","tags":["Limit Orders"],"parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["ACTIVE","TRIGGERED","FILLING","FILLED","FAILED","CANCELLED"]},"description":"Filter by order status"},{"name":"token_address","in":"query","schema":{"type":"string"},"description":"Filter by Solana token mint address"}],"responses":{"200":{"description":"List of limit orders. Returns an empty array if no orders match the filters.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LimitOrder"}}}}}}}}}}
```

## Get a single limit order

> Returns full details for a specific limit order including token metadata and fill information. The order must belong to the authenticated user.

```json
{"openapi":"3.0.3","info":{"title":"Indexify API","version":"0.1.12-beta"},"servers":[{"url":"https://api.indexify.finance","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key with the `ix_` prefix. You can generate an API Key by navigating to Settings -> API Key in the web app. Pass it in the `X-API-KEY` header on every request."}},"schemas":{"LimitOrder":{"type":"object","description":"Full limit order object returned by list and get actions. Includes token metadata and display fields.","properties":{"order_id":{"type":"string","description":"16-character unique order identifier"},"token_address":{"type":"string","description":"Solana token mint address"},"token_symbol":{"type":"string","nullable":true,"description":"Token ticker symbol"},"token_name":{"type":"string","nullable":true,"description":"Token display name"},"token_image":{"type":"string","nullable":true,"description":"Token logo URL"},"side":{"type":"string","enum":["buy","sell"],"description":"Order direction"},"condition_type":{"type":"string","enum":["lte","gte"],"description":"\"lte\" triggers when price <= target, \"gte\" triggers when price >= target"},"trigger_price":{"type":"number","description":"Target USD price threshold"},"amount":{"type":"number","description":"For buys: USDC amount. For sells: percentage of holdings (0-100)"},"amount_display":{"type":"string","description":"Human-readable amount — \"$50.00\" for buys, \"50%\" for sells"},"status":{"type":"string","enum":["ACTIVE","TRIGGERED","FILLING","FILLED","FAILED","CANCELLED"],"description":"Current lifecycle status"},"stack_id":{"type":"integer","description":"Company stack ID used for the trade"},"swap_provider":{"type":"string","enum":["jupiter","dflow"],"description":"Swap provider used for execution"},"created_at":{"type":"integer","description":"Unix timestamp of order creation"},"updated_at":{"type":"integer","nullable":true,"description":"Unix timestamp of last status change"},"triggered_at":{"type":"integer","nullable":true,"description":"Unix timestamp when the price condition was met"},"triggered_price":{"type":"number","nullable":true,"description":"Actual USD price that triggered the order"},"filled_at":{"type":"integer","nullable":true,"description":"Unix timestamp when the fill completed"},"fill_order_id":{"type":"string","nullable":true,"description":"Linked stack_orders.order_id for the fill"},"error_message":{"type":"string","nullable":true,"description":"Failure reason (only present when status is FAILED)"},"expires_at":{"type":"integer","nullable":true,"description":"Unix timestamp for automatic expiration, or null if no expiry"}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}},"paths":{"/api/limit_orders.php?action=get":{"get":{"operationId":"limitOrderGet","summary":"Get a single limit order","description":"Returns full details for a specific limit order including token metadata and fill information. The order must belong to the authenticated user.","tags":["Limit Orders"],"parameters":[{"name":"order_id","in":"query","required":true,"schema":{"type":"string"},"description":"The 16-character limit order ID"}],"responses":{"200":{"description":"Limit order details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LimitOrder"}}}},"404":{"description":"Order not found or does not belong to the authenticated user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
