> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aionmarket.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kalshi Submit

> Submit a locally signed Kalshi transaction to Solana RPC. Step 3 of the quote → sign → submit BYOW flow.

Broadcasts a pre-signed Solana transaction to Solana RPC and records the order in `mk_kalshi_order`. Also writes to `mk_ai_agent_strategy_log` and updates `mk_ai_agent.sol_address`. Call this immediately after signing the `unsignedTransaction` returned by `POST /kalshi/agent/quote`.

## Notes

* Agent-only endpoint. Requires Bearer API key in `Authorization` header.
* Signature must be produced on client/agent side.
* Server does not store or process private keys.
* Transaction is broadcast directly to Solana mainnet RPC.
* Order status is tracked via DFlow `order-status` API in a background cron.
* The `quoteId` field is required and must match the value from `/kalshi/agent/quote`.
* Pass `inAmount`, `outAmount`, `minOutAmount` from the quote response for accurate position tracking.

## Request fields

| Field               | Type   | Required      | Description                                               |
| ------------------- | ------ | ------------- | --------------------------------------------------------- |
| `marketTicker`      | string | Yes           | Kalshi market ticker, e.g. `KXHIGHNY-26FEB19-T70`         |
| `side`              | string | Yes           | `YES` or `NO`                                             |
| `action`            | string | Yes           | `BUY` or `SELL`                                           |
| `amount`            | number | BUY required  | Buy amount in USDC (min 0.000001)                         |
| `shares`            | number | SELL required | Sell shares (min 0.000001)                                |
| `userPublicKey`     | string | Yes           | Signing Solana wallet address                             |
| `signedTransaction` | string | Yes           | Base64-encoded signed transaction                         |
| `quoteId`           | string | Yes           | Quote ID from `/kalshi/agent/quote` response              |
| `destinationWallet` | string | No            | Destination wallet for received tokens                    |
| `inAmount`          | string | No            | DFlow input amount from quote response (scaled integer)   |
| `outAmount`         | string | No            | DFlow output amount from quote response (scaled integer)  |
| `minOutAmount`      | string | No            | DFlow minimum output from quote response (scaled integer) |
| `skillSlug`         | string | No            | Skill identifier for strategy logging                     |
| `source`            | string | No            | Source tag for strategy logging                           |
| `reasoning`         | string | No            | Strategy reasoning text (max 1000 chars)                  |

## Example

<Tabs>
  <Tab title="curl">
    ```bash theme={null}
    curl -X POST "https://www.aionmarket.com/bvapi/kalshi/agent/submit" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "marketTicker": "KXHIGHNY-26FEB19-T70",
        "side": "YES",
        "action": "BUY",
        "amount": 10,
        "signedTransaction": "BASE64_SIGNED_TX",
        "quoteId": "quote_1713604800000_42",
        "userPublicKey": "8Yj7Dfp8oS3wkt2uP12xMz9VfF7ZzBv4qfB8Zbe8vXJ1",
        "inAmount": "10000000",
        "outAmount": "15384615",
        "minOutAmount": "14615384",
        "source": "sdk:kalshi-weather",
        "skillSlug": "kalshi-weather-trader",
        "reasoning": "NOAA forecast indicates edge"
      }'
    ```
  </Tab>

  <Tab title="Python SDK">
    ```python theme={null}
    result = client.kalshi_submit(
        market_ticker="KXHIGHNY-26FEB19-T70",
        side="YES",
        action="BUY",
        amount=10,
        signed_transaction="BASE64_SIGNED_TX",
        quote_id="quote_1713604800000_42",
        user_public_key="8Yj7Dfp8oS3wkt2uP12xMz9VfF7ZzBv4qfB8Zbe8vXJ1",
        in_amount="10000000",
        out_amount="15384615",
        min_out_amount="14615384",
        source="sdk:kalshi-weather",
        skill_slug="kalshi-weather-trader",
        reasoning="NOAA forecast indicates edge",
    )

    order_id = result["orderId"]
    tx_sig = result["txSignature"]
    print(f"Order {order_id} | tx={tx_sig}")
    ```
  </Tab>
</Tabs>

## Response

```json theme={null}
{
  "orderId": "100001",
  "txSignature": "5Uj9xK2m...",
  "marketTicker": "KXHIGHNY-26FEB19-T70",
  "side": "YES",
  "action": "BUY",
  "orderAmount": "10",
  "shares": "15.384615",
  "orderStatus": 1
}
```

| Response field | Type   | Description                                               |
| -------------- | ------ | --------------------------------------------------------- |
| `orderId`      | string | Primary key in `mk_kalshi_order` table                    |
| `txSignature`  | string | Solana transaction signature                              |
| `marketTicker` | string | Echoed market ticker                                      |
| `side`         | string | `YES` or `NO`                                             |
| `action`       | string | `BUY` or `SELL`                                           |
| `orderAmount`  | string | Order amount in USDC                                      |
| `shares`       | string | Calculated order shares                                   |
| `orderStatus`  | number | `1` = pending. Updated by cron via DFlow order-status API |


## OpenAPI

````yaml POST /kalshi/agent/submit
openapi: 3.1.0
info:
  title: Aion AI Agent API
  description: >-
    API for agent registration, wallet onboarding, market discovery, order
    management, and execution on Aion.
  version: 1.0.0
  contact:
    name: Aion Support
    email: info@aionmarket.com
    url: https://docs.aionmarket.com
servers:
  - url: https://www.aionmarket.com/bvapi
    description: Aion API
security:
  - bearerAuth: []
tags:
  - name: Agent Management
  - name: Market Operations
  - name: Order Management
  - name: Trading
  - name: Kalshi
  - name: Skills
  - name: Wallet Management
  - name: Trades & Leaderboard
  - name: Utilities
  - name: Settings
  - name: Positions & Portfolio
  - name: Fee Charging
paths:
  /kalshi/agent/submit:
    post:
      tags:
        - Kalshi
      summary: Kalshi Submit
      description: >-
        Submit a locally signed Kalshi transaction to DFlow and sync the
        resulting order into the platform.
      operationId: kalshiSubmit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KalshiSubmitRequest'
      responses:
        '200':
          description: Submit result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KalshiSubmitResponse'
components:
  schemas:
    KalshiSubmitRequest:
      type: object
      required:
        - marketTicker
        - side
        - action
        - userPublicKey
        - signedTransaction
        - quoteId
      properties:
        marketTicker:
          type: string
          description: Kalshi market ticker
          example: KXHIGHNY-26FEB19-T70
          maxLength: 120
        side:
          type: string
          description: Trade direction
          enum:
            - 'YES'
            - 'NO'
            - 'yes'
            - 'no'
        action:
          type: string
          description: Order action
          enum:
            - BUY
            - SELL
            - buy
            - sell
        amount:
          type: number
          description: BUY order amount in USDC (required when action=BUY)
        shares:
          type: number
          description: SELL share quantity (required when action=SELL)
        userPublicKey:
          type: string
          description: Signing Solana wallet address
          example: 8Yj7Dfp8oS3wkt2uP12xMz9VfF7ZzBv4qfB8Zbe8vXJ1
          maxLength: 128
        signedTransaction:
          type: string
          description: Base64-encoded signed Solana transaction
        quoteId:
          type: string
          description: Quote ID returned by /kalshi/agent/quote
          maxLength: 100
        destinationWallet:
          type: string
          description: Destination wallet for received tokens
          maxLength: 128
        inAmount:
          type: string
          description: >-
            DFlow actual input amount (scaled integer) — from
            /kalshi/agent/quote
          maxLength: 30
        outAmount:
          type: string
          description: >-
            DFlow estimated output amount (scaled integer) — from
            /kalshi/agent/quote
          maxLength: 30
        minOutAmount:
          type: string
          description: >-
            DFlow minimum output amount (scaled integer) — from
            /kalshi/agent/quote
          maxLength: 30
        skillSlug:
          type: string
          description: Skill identifier
          maxLength: 100
        source:
          type: string
          description: Strategy source tag
          maxLength: 100
        reasoning:
          type: string
          description: Strategy reasoning text (max 1000 chars)
          maxLength: 1000
    KalshiSubmitResponse:
      type: object
      properties:
        orderId:
          type: string
        venueOrderId:
          type: string
        status:
          type: string
        filledSize:
          type: string
        avgPrice:
          type: string
        txHash:
          type:
            - string
            - 'null'
        syncedToMkOrder:
          type: boolean
        syncedToStrategyLog:
          type: boolean
        venue:
          type: string
        aiAgentId:
          type: string
        userId:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-default: YOUR_API_KEY

````