# OrdersApi

All URIs are relative to *https://api.elections.kalshi.com/trade-api/v2*

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**amendOrder**](#amendorder) | **POST** /portfolio/orders/{order_id}/amend | Amend Order|
|[**batchCancelOrders**](#batchcancelorders) | **DELETE** /portfolio/orders/batched | Batch Cancel Orders|
|[**batchCreateOrders**](#batchcreateorders) | **POST** /portfolio/orders/batched | Batch Create Orders|
|[**cancelOrder**](#cancelorder) | **DELETE** /portfolio/orders/{order_id} | Cancel Order|
|[**createOrder**](#createorder) | **POST** /portfolio/orders | Create Order|
|[**decreaseOrder**](#decreaseorder) | **POST** /portfolio/orders/{order_id}/decrease | Decrease Order|
|[**getOrder**](#getorder) | **GET** /portfolio/orders/{order_id} | Get Order|
|[**getOrderQueuePosition**](#getorderqueueposition) | **GET** /portfolio/orders/{order_id}/queue_position | Get Order Queue Position|
|[**getOrderQueuePositions**](#getorderqueuepositions) | **GET** /portfolio/orders/queue_positions | Get Queue Positions for Orders|
|[**getOrders**](#getorders) | **GET** /portfolio/orders | Get Orders|

# **amendOrder**
> AmendOrderResponse amendOrder(amendOrderRequest)

 Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max fillable contracts is `remaining_count` + `fill_count`.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **amendOrderRequest** | **AmendOrderRequest**|  | |
| **orderId** | [**string**] | Order ID | defaults to undefined|


### Return type

**AmendOrderResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Order amended successfully |  -  |
|**400** | Bad request - invalid input |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**404** | Resource not found |  -  |
|**500** | Internal server error |  -  |

# **batchCancelOrders**
> BatchCancelOrdersResponse batchCancelOrders(batchCancelOrdersRequest)

 Endpoint for cancelling up to 20 orders at once.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **batchCancelOrdersRequest** | **BatchCancelOrdersRequest**|  | |


### Return type

**BatchCancelOrdersResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Batch order cancellation completed |  -  |
|**400** | Bad request - invalid input |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**403** | Forbidden - insufficient permissions |  -  |
|**500** | Internal server error |  -  |

# **batchCreateOrders**
> BatchCreateOrdersResponse batchCreateOrders(batchCreateOrdersRequest)

 Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per-second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **batchCreateOrdersRequest** | **BatchCreateOrdersRequest**|  | |


### Return type

**BatchCreateOrdersResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**201** | Batch order creation completed |  -  |
|**400** | Bad request - invalid input |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**403** | Forbidden - insufficient permissions |  -  |
|**500** | Internal server error |  -  |

# **cancelOrder**
> CancelOrderResponse cancelOrder()

 Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can\'t completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **orderId** | [**string**] | Order ID | defaults to undefined|
| **subaccount** | [**number**] | Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0. | (optional) defaults to undefined|


### Return type

**CancelOrderResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Order cancelled successfully |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**404** | Resource not found |  -  |
|**500** | Internal server error |  -  |

# **createOrder**
> CreateOrderResponse createOrder(createOrderRequest)

 Endpoint for submitting orders in a market. Each user is limited to 200 000 open orders at a time.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **createOrderRequest** | **CreateOrderRequest**|  | |


### Return type

**CreateOrderResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**201** | Order created successfully |  -  |
|**400** | Bad request - invalid input |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**409** | Conflict - resource already exists or cannot be modified |  -  |
|**429** | Rate limit exceeded |  -  |
|**500** | Internal server error |  -  |

# **decreaseOrder**
> DecreaseOrderResponse decreaseOrder(decreaseOrderRequest)

 Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **decreaseOrderRequest** | **DecreaseOrderRequest**|  | |
| **orderId** | [**string**] | Order ID | defaults to undefined|


### Return type

**DecreaseOrderResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Order decreased successfully |  -  |
|**400** | Bad request - invalid input |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**404** | Resource not found |  -  |
|**500** | Internal server error |  -  |

# **getOrder**
> GetOrderResponse getOrder()

 Endpoint for getting a single order.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **orderId** | [**string**] | Order ID | defaults to undefined|


### Return type

**GetOrderResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Order retrieved successfully |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**404** | Resource not found |  -  |
|**500** | Internal server error |  -  |

# **getOrderQueuePosition**
> GetOrderQueuePositionResponse getOrderQueuePosition()

 Endpoint for getting an order\'s queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **orderId** | [**string**] | Order ID | defaults to undefined|


### Return type

**GetOrderQueuePositionResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Queue position retrieved successfully |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**404** | Resource not found |  -  |
|**500** | Internal server error |  -  |

# **getOrderQueuePositions**
> GetOrderQueuePositionsResponse getOrderQueuePositions()

 Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority.

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **marketTickers** | [**string**] | Comma-separated list of market tickers to filter by | (optional) defaults to undefined|
| **eventTicker** | [**string**] | Event ticker to filter by | (optional) defaults to undefined|
| **subaccount** | [**number**] | Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0. | (optional) defaults to undefined|


### Return type

**GetOrderQueuePositionsResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Queue positions retrieved successfully |  -  |
|**400** | Bad request - invalid input |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**500** | Internal server error |  -  |

# **getOrders**
> GetOrdersResponse getOrders()

Restricts the response to orders that have a certain status: resting, canceled, or executed. Orders that have been canceled or fully executed before the historical cutoff are only available via `GET /historical/orders`. Resting orders will always be available through this endpoint. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details. 

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **ticker** | [**string**] | Filter by market ticker | (optional) defaults to undefined|
| **eventTicker** | [**string**] | Event tickers to filter by, as a comma-separated list (maximum 10). | (optional) defaults to undefined|
| **minTs** | [**number**] | Filter items after this Unix timestamp | (optional) defaults to undefined|
| **maxTs** | [**number**] | Filter items before this Unix timestamp | (optional) defaults to undefined|
| **status** | [**string**] | Filter by status. Possible values depend on the endpoint. | (optional) defaults to undefined|
| **limit** | [**number**] | Number of results per page. Defaults to 100. Maximum value is 200. | (optional) defaults to 100|
| **cursor** | [**string**] | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. | (optional) defaults to undefined|
| **subaccount** | [**number**] | Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts. | (optional) defaults to undefined|


### Return type

**GetOrdersResponse**

### Authorization

[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Orders retrieved successfully |  -  |
|**400** | Bad request - invalid input |  -  |
|**401** | Unauthorized - authentication required |  -  |
|**500** | Internal server error |  -  |

