---
title: "Create a new order"
method: POST
path: "/v0/orders"
tags: ["Orders"]
---

# Create a new order

`POST /v0/orders`

## Headers

- `Idempotency-Key` string, nullable

## Request body

- MarketApiCreateOrderRequest
  - `side` 'sell' | 'buy', required
  - `instance_type` string
  - `quantity` integer, required
  - `start_at` string, required — A date/time value that can be either "NOW" or an ISO 8601 datetime string
  - `end_at` string, required — A date/time value that can be either "NOW" or an ISO 8601 datetime string
  - `price` integer, required — Price in cents
  - `flags` MarketApiOrderFlags — Configure more fine grained order behavior.
    - `ioc` boolean — If true, the order will be automatically cancelled if it doesn't immediately fill when being placed.
    - `post_only` boolean — If true, places the order straight into the book without trying to match against existing orders.
    - `market` boolean — If true, ignores the set limit price and matches any price that is available.
    - `prorate` boolean — If the order start time should be automatically changed to "now" once start time < "now", proportionally changing it's limit price to reflect it's shorter duration.
  - `colocate_with` MarketApiContractId[] — A contract to colocate with. This overrides the instance_type if specified.
  - `cluster` string

## Response `201`

Order created successfully

- MarketApiCreateOrderResponse
  - `object` 'order', required
  - `status` 'pending' | 'filled' | 'cancelled', required
  - `id` string, required
  - `idempotency_key` string, nullable

## Other responses

- `400` — Invalid request parameters
- `401` — Unauthorized - missing or invalid authentication token
- `403` — Forbidden - account frozen, insufficient credits, unauthorized seller, or trading halted
- `404` — Not found - contract or cluster not found
- `426` — Upgrade required - legacy account needs migration
- `500` — Internal server error

---

[API](https://skmtc.net/sfcompute/apis/san-francisco-compute-documentation.md) · [All operations](https://skmtc.net/sfcompute/apis/san-francisco-compute-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sfcompute/san-francisco-compute-documentation/revisions/93dd7661e9bb/schema)
