# Create API Key

Use these endpoints for order placement and risk controls.

All endpoints on this page require API key authentication.

### Place Limit Order

```
POST /orders/limit
```

#### Request Body

| Field | Type   | Required | Description                      |
| ----- | ------ | -------- | -------------------------------- |
| e     | string | Yes      | Event ID                         |
| o     | string | Yes      | Market ID                        |
| ba    | string | Yes      | Outcome asset ID to trade        |
| qa    | string | Yes      | Quote asset ID. Use `asset_usdc` |
| s     | string | Yes      | Side: `BUY` or `SELL`            |
| p     | number | Yes      | Price from `0.01` to `0.99`      |
| q     | number | Yes      | Quantity in shares               |

#### Example Request

```json
{
  "e": "evt_btc_100k_2026",
  "o": "mkt_btc_100k_yes_no",
  "ba": "asset_btc_100k_yes",
  "qa": "asset_usdc",
  "s": "BUY",
  "p": 0.42,
  "q": 100
}
```

#### Response `200 OK` or `202 Accepted`

```json
{
  "i": "ord_7f3a9c2d"
}
```

| Field | Type   | Description |
| ----- | ------ | ----------- |
| i     | string | Order ID    |

### Place Market Order

```
POST /orders/market
```

Creates a new API key.

The `secret` is shown only once.

Creating a new key deactivates the previous key.

### Authentication

Authenticated account access required.

### Common errors

| Code | Description                                      |
| ---- | ------------------------------------------------ |
| 200  | OK — Request succeeded                           |
| 201  | Created — Resource created successfully          |
| 204  | No Content — Success with no response body       |
| 400  | Bad Request — Invalid parameters                 |
| 401  | Unauthorized — Missing or invalid authentication |
| 403  | Forbidden — Operation not allowed                |
| 404  | Not Found — Resource does not exist              |
| 429  | Too Many Requests — Rate limit exceeded          |
| 500  | Internal Server Error                            |

#### Request Body

| Field | Type   | Required    | Description                                 |
| ----- | ------ | ----------- | ------------------------------------------- |
| e     | string | Yes         | Event ID                                    |
| o     | string | Yes         | Market ID                                   |
| ba    | string | Yes         | Outcome asset ID                            |
| qa    | string | Yes         | Quote asset ID                              |
| s     | string | Yes         | Side: `BUY` or `SELL`                       |
| am    | number | Conditional | USDC amount to spend. Required for `BUY`    |
| q     | number | Conditional | Share quantity to sell. Required for `SELL` |

#### Example Request for BUY

```json
{
  "e": "evt_btc_100k_2026",
  "o": "mkt_btc_100k_yes_no",
  "ba": "asset_btc_100k_yes",
  "qa": "asset_usdc",
  "s": "BUY",
  "am": 50
}
```

#### Example Request for SELL

```json
{
  "e": "evt_btc_100k_2026",
  "o": "mkt_btc_100k_yes_no",
  "ba": "asset_btc_100k_yes",
  "qa": "asset_usdc",
  "s": "SELL",
  "q": 100
}
```

#### Response `200 OK` or `202 Accepted`

```json
{
  "i": "ord_7f3a9c2d"
}
```

### Cancel Order

```
DELETE /orders/limit/{orderId}
```

#### Path Parameters

| Parameter | Type   | Description        |
| --------- | ------ | ------------------ |
| orderId   | string | Order ID to cancel |

#### Example

```
DELETE /orders/limit/ord_7f3a9c2d
```

#### Response `200 OK` or `204 No Content`

### Set Take Profit / Stop Loss

```
POST /orders/tpsl
```

#### Request Body

| Field | Type   | Required | Description               |
| ----- | ------ | -------- | ------------------------- |
| e     | string | Yes      | Event ID                  |
| o     | string | Yes      | Market ID                 |
| ba    | string | Yes      | Position asset ID         |
| oa    | string | Yes      | Opening asset ID          |
| qa    | string | Yes      | Quote asset ID            |
| i     | string | Yes      | Indication: `YES` or `NO` |
| s     | string | Yes      | Side. Use `SELL`          |
| q     | number | Yes      | Quantity to close         |
| t     | number | No       | Take-profit price         |
| l     | number | No       | Stop-loss price           |

At least one of `t` or `l` is required.

#### Example Request

```json
{
  "e": "evt_btc_100k_2026",
  "o": "mkt_btc_100k_yes_no",
  "ba": "asset_btc_100k_yes",
  "oa": "asset_btc_100k_yes",
  "qa": "asset_usdc",
  "i": "YES",
  "s": "SELL",
  "q": 100,
  "t": 0.95,
  "l": 0.1
}
```

#### Response `200 OK` or `202 Accepted`

### Get TP/SL Orders

```
GET /orders/tpsl
```

#### Query Parameters

| Parameter | Type    | Required | Description                    |
| --------- | ------- | -------- | ------------------------------ |
| assetId   | string  | Yes      | Asset ID                       |
| status    | string  | No       | Status filter such as `ACTIVE` |
| primary   | boolean | No       | Filter primary orders          |

#### Example

```
GET /orders/tpsl?assetId=asset_btc_100k_yes&status=ACTIVE
```

* Method: `POST`
* Path: `/auth/api-key`

#### Request body

| Field     | Type   | Required | Description                        |
| --------- | ------ | -------- | ---------------------------------- |
| code      | string | Yes      | Email confirmation code            |
| otp       | string | No       | 2FA OTP code, if 2FA is enabled    |
| expiresAt | string | No       | Expiration time in ISO 8601 format |

#### Response `200 OK`

```json
[
  {
    "i": "tpsl_4e2b1a90",
    "t": 0.95,
    "l": 0.1,
    "q": 100,
    "status": "ACTIVE"
  }
]
```

### Cancel TP/SL Order

```
DELETE /orders/tpsl/{tpslId}
```

#### Path Parameters

| Parameter | Type   | Description    |
| --------- | ------ | -------------- |
| tpslId    | string | TP/SL order ID |

#### Example

```
DELETE /orders/tpsl/tpsl_4e2b1a90
```

#### Response `200 OK` or `204 No Content`

**Response** `200 OK`

```json
{
  "id": "uuid",
  "key": "op_k_1a2b3c4d5e6f...",
  "secret": "base64_encoded_secret",
  "createdAt": "2026-01-15T10:30:00Z",
  "expiresAt": null
}
```

| Field     | Type   | Description                    |
| --------- | ------ | ------------------------------ |
| id        | string | API key record ID              |
| key       | string | Public API key                 |
| secret    | string | Secret for HMAC signing        |
| createdAt | string | Creation timestamp (ISO 8601)  |
| expiresAt | string | Expiration timestamp or `null` |


---

# 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.outpoll.com/api/rest-api/private-endpoints/api-key-management/create-api-key.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.
