# Status Codes for Financial Operations

1. [Order status codes](#order-status-codes)
2. [Transfer status codes](#transfer-status-codes)
3. [Transaction status codes](#transaction-status-codes)

## Order status codes

<table><thead><tr><th width="137.20025634765625">Order status code</th><th width="198.25006103515625">Description of status code</th><th width="215.46240234375">Possible previous status codes</th><th>Possible next status codes</th></tr></thead><tbody><tr><td>RECEIVED</td><td>The order request was passed through the API layer.</td><td>N/A</td><td>N/A</td></tr><tr><td>INVALID</td><td>The order request did not pass the API-level validation (e.g., the <code>Requestor-ID</code> references a natural person that is not in ACTIVE status). A webhook notification is sent for this status. <strong>Note:</strong> records with INVALID status are retained for <strong>48 hours only</strong>. After that period, they are automatically purged and can no longer be retrieved via API.</td><td>N/A</td><td>N/A</td></tr><tr><td>PENDING</td><td>This status indicates that the order was received by the system and is now in the queue to be processed. At this stage, the order details are registered, but no trading actions have been taken yet.</td><td>N/A</td><td><ul><li>FILLED</li><li>CANCELED</li><li>REJECTED</li></ul></td></tr><tr><td>CANCELED</td><td>The order has been canceled either by the user or the system. This means that the order will no longer be processed or executed. Cancellation can occur at any point before the order is filled.</td><td><ul><li>PENDING</li><li>CORRECTED</li></ul></td><td>N/A</td></tr><tr><td>REJECTED</td><td>This status indicates that the order has been rejected by the exchange. Rejection can occur due to various reasons such as insufficient funds, invalid order parameters, or system errors. A rejected order will not be processed or executed. A webhook notification is sent along with the rejection reason.</td><td><ul><li>PENDING</li></ul></td><td>N/A</td></tr><tr><td>FILLED</td><td>The order has been successfully executed and the trade is complete. All the requested amount has been traded at the specified or better price. The order is now closed with this final status.</td><td><ul><li>PENDING</li></ul></td><td><ul><li>SETTLED</li></ul></td></tr><tr><td>CORRECTED</td><td>This status indicates that there has been a correction on the order. This can happen due to post-trade processes where discrepancies are found and corrected to ensure the accuracy of trade records.</td><td><ul><li>FILLED</li></ul></td><td><ul><li>CANCELED</li></ul></td></tr><tr><td>SETTLED</td><td>The order has been fully settled, meaning that all financial transactions related to the trade are complete. This status indicates that the trade has been finalized, and the funds or assets have been transferred accordingly. Now the funds can be withdrawn.</td><td><ul><li>FILLED</li></ul></td><td>N/A</td></tr></tbody></table>

Sequence diagram

```mermaid
sequenceDiagram
participant Partner    
participant Platform

Partner->>Platform: POST Create MARKET order (10 BTC)
Platform -->> Partner: Order-id(Order status RECEIVED)

Platform->>Platform: Order processing

alt order executed
Platform->>Platform: Balance and position updated
Platform->>Partner: Order status FILLED
Platform->>Platform: Settlement completed
Platform->>Partner: Order status SETTLED
end
opt insufficient balance/position
Platform->>Partner: Order status REJECTED
end
```

### Order Cancellation Behavior

When a cancel order request is submitted via `DELETE /traditional/orders/{orderId}`:

* **Successful cancellation:** The order status changes to `CANCELED` and a webhook notification is dispatched to the partner.
* **Failed cancellation:** No webhook notification is sent. The order retains its previous status (e.g., `PENDING`). Partners should verify the order status via the Get Order endpoint if cancellation confirmation is not received.

### Data Retention for INVALID Orders

Orders (and other records) with `INVALID` status are retained for **48 hours only**. After this period, they are automatically purged from the system and will return a `Not Found` response when queried via the API. Partners should capture and log all webhook notifications for INVALID statuses immediately upon receipt.

### Trade Document Generation

After a traditional order reaches `FILLED` status, the corresponding trade document (`TRADE_INVOICE`) is typically generated within a few seconds of the execution. The document can be retrieved via `GET /traditional/orders/trade-invoice/{executionId}`.

{% hint style="warning" %}
**Test Environment Note:** Trade documents can only be generated for assets that exist in the environment's asset universe. When testing in the sandbox environment, ensure you use only the ISINs provided in the supported asset list. Using ISINs outside the asset universe will result in missing trade documents even if the order itself was executed successfully.
{% endhint %}

## Transfer status codes

<table><thead><tr><th width="250.203857421875">Transfer status code</th><th>Description of status code</th></tr></thead><tbody><tr><td>RECEIVED</td><td>The transfer request was passed through the API layer.</td></tr><tr><td>INVALID</td><td>The transfer order request did not pass the validation.</td></tr><tr><td>PENDING</td><td>The transfer is created but not processed as some operations or checks are being performed.</td></tr><tr><td>REJECTED</td><td>The transfer was rejected. Please check the error codes for further details</td></tr><tr><td>PROCESSED</td><td>The transfer was successfully processed.</td></tr></tbody></table>

Sequence diagram

```mermaid
sequenceDiagram
participant Partner    
participant Platform
participant SEPA

Note over Partner,Platform: Incoming transfer
SEPA->>Platform: Transfer notification
Platform->>Platform: Balance updated
Platform->>Partner: Transfer notification (status PROCESSED) 

Note over Partner,Platform: Outgoing transfer
Partner->>Platform: Create Transfer
Platform -->> Partner: Transfer created (transfer id, status RECEIVED)

alt transfer processed
Platform->>Platform: Balance updated
Platform->>SEPA: Create Transfer
SEPA-->>Platform: 
Platform->>Partner: Transfer notification (status PENDING)
SEPA->>Platform: Transfer notification
Platform->>Partner: Transfer notification (status PROCESSED)
end
opt insufficient balance
Platform->>Partner: Transfer notification (status REJECTED)
end
```

## Transaction status codes

The list of Transaction status codes

<table><thead><tr><th width="249.87713623046875">Transaction status code</th><th>Description of status codes</th></tr></thead><tbody><tr><td>COMPLETED</td><td>This status means that the transaction has been fully processed or (for orders) executed successfully. All steps required to finalize the transaction have been carried out.</td></tr><tr><td>MODIFIED</td><td>This status signifies that the transaction details have been altered or updated after its initial completion. It reflects any changes made to the transaction parameters.</td></tr></tbody></table>

### Mapping of Transaction status codes

#### Order and Transaction status codes

<table><thead><tr><th width="249.7066650390625">No.</th><th>Order status</th><th>Transaction status</th></tr></thead><tbody><tr><td>1</td><td>RECEIVED</td><td>N/A</td></tr><tr><td>2</td><td>INVALID</td><td>N/A</td></tr><tr><td>3</td><td>PENDING</td><td>N/A</td></tr><tr><td>4</td><td>CANCELED</td><td>N/A</td></tr><tr><td>5</td><td>REJECTED</td><td>N/A</td></tr><tr><td>6</td><td>FILLED</td><td>COMPLETED</td></tr><tr><td>7</td><td>CORRECTED</td><td>MODIFIED</td></tr><tr><td>8</td><td>SETTLED</td><td>COMPLETED</td></tr></tbody></table>

#### Transfer and Transaction status codes

| No. | Transfer status | Transaction status |
| --- | --------------- | ------------------ |
| 1   | RECEIVED        | N/A                |
| 2   | INVALID         | N/A                |
| 3   | PENDING         | N/A                |
| 4   | REJECTED        | N/A                |
| 5   | PROCESSED       | COMPLETED          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tradevest.ai/documentation/status_codes_for_financial_operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
