Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.hit.com/llms.txt

Use this file to discover all available pages before exploring further.

Order endpoints require API key authentication. See Authentication for HMAC signing.

Order Model

Hit accepts low-level order payloads built from outcome token amounts.
FieldRequiredDescription
saltYesUnique numeric string
takerYesUsually 0x0000000000000000000000000000000000000000
tokenIdYesOutcome token ID from market data
makerAmountYesAmount supplied by the maker, in 6-decimal base units
takerAmountYesAmount requested from the taker, in 6-decimal base units
expirationYesUnix timestamp seconds, or 0
sideYes0 for buy, 1 for sell
orderTypeYesGTC, FOK, or FAK
feeRateBpsClient-signed onlyMust match the market orderFeeRateBps
signatureOptionalInclude for client-signed orders; omit when using server-side session signer
priceUintOptionalServer-compatible price integer when your client already computes it
Amounts use 6 decimals:
1 USDC = 1000000
1 share = 1000000
For limit orders:
SideMeaning
Buy (side: 0)makerAmount is USDC, takerAmount is shares, price = makerAmount / takerAmount
Sell (side: 1)makerAmount is shares, takerAmount is USDC, price = takerAmount / makerAmount
Limit order prices must be valid multiples of the market tickSize.

Place an Order

import { createHmac, randomBytes } from "node:crypto";

type JsonObject = Record<string, unknown>;

function units(value: number) {
  return Math.round(value * 1_000_000).toString();
}

function sign(secret: string, timestamp: string, method: string, path: string, body = "") {
  return createHmac("sha256", secret)
    .update(`${timestamp}${method.toUpperCase()}${path}${body}`)
    .digest("hex");
}

async function request(method: string, path: string, body?: JsonObject) {
  const fullPath = `/api/v1${path}`;
  const timestamp = Date.now().toString();
  const bodyText = body ? JSON.stringify(body) : "";

  const response = await fetch(`https://hit.com${fullPath}`, {
    method,
    headers: {
      "Content-Type": "application/json",
      "hit-api-key": process.env.HIT_API_KEY!,
      "hit-signature": sign(process.env.HIT_API_SECRET!, timestamp, method, fullPath, bodyText),
      "hit-timestamp": timestamp,
      "hit-passphrase": process.env.HIT_API_PASSPHRASE!,
    },
    body: bodyText || undefined,
  });

  if (!response.ok) {
    throw new Error(`${response.status}: ${await response.text()}`);
  }

  return response.json() as Promise<unknown>;
}

const order = await request("POST", "/orders", {
  salt: BigInt(`0x${randomBytes(32).toString("hex")}`).toString(),
  taker: "0x0000000000000000000000000000000000000000",
  tokenId: process.env.HIT_TOKEN_ID!,
  makerAmount: units(31), // USDC
  takerAmount: units(50), // shares
  expiration: 0,
  side: 0,
  orderType: "GTC",
});

console.log(order);
The examples buy 50 shares for 31 USDC, which is a 0.62 limit price.

List Orders

curl 'https://hit.com/api/v1/orders' \
  -H 'hit-api-key: API_KEY' \
  -H 'hit-signature: SIGNATURE' \
  -H 'hit-timestamp: TIMESTAMP' \
  -H 'hit-passphrase: API_PASSPHRASE'
Filters:
QueryDescription
marketMarket UUID
statusPENDING, EXECUTING, EXECUTED, CANCELLED, or REJECTED
makerMaker wallet address
marketNameCase-insensitive partial market name
sortByOrder sort field, default created_at
orderASC or DESC
Use GET /orders/paginated for paginated results.

Cancel Orders

RequestDescription
POST /orders/{id}/cancelCancel one order and return the updated order
DELETE /orders/{id}Delete one order and return { "success": true }
POST /orders/batch-cancelCancel up to 50 order IDs
POST /orders/cancelCancel all orders in one market
POST /orders/cancel-allCancel all your orders
Cancel one order:
await request("POST", `/orders/${process.env.HIT_ORDER_ID!}/cancel`);
Cancel a batch:
await request("POST", "/orders/batch-cancel", {
  orderIds: ["ORDER_UUID_1", "ORDER_UUID_2"],
});
Cancel all orders in a market:
await request("POST", "/orders/cancel", {
  market: "MARKET_UUID",
});

Positions and Activity

These endpoints also accept API key authentication:
RequestDescription
GET /markets/user-positionsCurrent user positions
GET /markets/valuePosition value for the current user or a supplied proxy wallet
GET /markets/user-activityUser activity feed
GET /markets/traded-countNumber of markets traded
GET /orders/eventsActive order book events