Skip to main content
Upside uses a small set of consistent conventions for data representation throughout the API. Understanding these conventions upfront will save you debugging time — in particular, note that prices and sizes are strings, not numbers, and that raw integer values in responses must be scaled before display.

Numeric Values: Strings to Avoid Float Precision Loss

All prices, quantities, and monetary amounts are represented as decimal strings rather than JSON numbers. This avoids the floating-point precision loss that occurs when JSON parsers store large or fractional numbers as IEEE 754 doubles.
Always treat these fields as strings when reading or writing. Pass them through to your exchange layer without converting to float.

Raw Integers and Scale Factors

Numeric values in API responses are raw integers. To obtain the human-readable display value, divide by 10 raised to the scale exponent for that field. Use the configs endpoint to retrieve priceScale and qtyScale for each contract.
The SOL1 contract’s priceScale and qtyScale are published by the configs endpoint. Always read scale values from configs rather than hardcoding them — they differ per contract and can change when new contracts are listed.

Timestamps

All timestamps are int64 Unix milliseconds — the number of milliseconds elapsed since 1970-01-01T00:00:00Z. Timestamps are represented as JSON integers (not strings).

Ethereum Addresses

Addresses follow the standard Ethereum format: 0x prefix followed by 40 lowercase hexadecimal characters (42 characters total).
Always send addresses in lowercase. The server compares addresses case-insensitively, but using lowercase consistently avoids subtle bugs in signature verification and logging.

Contract (Asset) IDs

Each perpetual contract has an integer ID stored in the a field of order, cancel, and modify actions. On testnet, the only available contract is SOL1 with ID 1. Call configs to enumerate all contracts and their IDs in any environment.

Client Order IDs (cloid)

A client order ID is an int64 decimal string that you assign when placing an order. It must be a unique positive integer. You can use it later to cancel or query orders without needing the server-assigned oid.
A Unix millisecond timestamp works well as a client order ID for most use cases — it is unique, monotonically increasing, and easy to generate without a counter.

Short Key Convention (Order Payloads)

Order-related actions use single-letter compact keys to reduce payload size. The mapping is: Example order object using short keys:

Full Key Convention (Margin and Mode Actions)

Margin and account mode actions use full field names rather than single-letter abbreviations: Example leverage update using full keys: