Basic Info
Start with the basics
General rules
All API responses are JSON.
All times and timestamps are Unix time in milliseconds.
For
GETrequests, append parameters to the URL query string.POSTrequests use eitherapplication/jsonorapplication/x-www-form-urlencoded, as specified per endpoint.Endpoints that require authentication must include
APIKEYandsignaturein the request headers.
When Signature required is Yes, add these headers:
APIKEY
Your API key (app_key)
signature
HMAC-SHA256 signature of the request payload, keyed with app_secret
Access
Mainnet
https://api.astros.ag
wss://api.astros.ag/api/market/ws
Apply for an API key
The API has three categories: public queries, private queries, and private operations. Private endpoints require an API key.
The platform issues an app_key and app_secret over a secure channel:
app_key
Sent as the APIKEY request header
app_secret
Used to sign request payloads. Store securely and never expose it
Prerequisites
Before you start:
Sui wallet — You need a Sui wallet and its private key.
Registered Astros account — Connect your wallet on Astros and sign in at least once.
No open positions (recommended) — Avoid creating an API key while you have active positions. After creating a key, avoid trading on the web UI with the same account, which can cause unexpected behavior.
Dev environment (optional) — Install language SDKs if you plan to call the API from code.
Quick start
Step 1: Generate a wallet signature
Node.js example (see Sample signature code for other languages):
Step 2: Call the apply endpoint
Step 3: Save the API secret
apiSecret is shown only once. Store it immediately.
After creation, the API key enters manual review (typically 1–2 business days). Trading with the key is only available after approval.
Create API key
POST /api/contract-sub-provider/user/apikey/apply
Content-Type: application/json
Auth: Wallet personal-message signature (not HMAC)
Message to sign
Request body
address
String
Yes
Sui wallet address
label
String
Yes
Human-readable key label
timestamp
Number
Yes
Unix time in milliseconds
signature
String
Yes
Wallet signature of the message above
Example request
Example response
List API keys
POST /api/contract-sub-provider/user/apikey/list
Content-Type: application/json
Auth: Wallet personal-message signature
Message to sign
Request body
address
String
Yes
Sui wallet address
timestamp
Number
Yes
Unix time in milliseconds
signature
String
Yes
Wallet signature of the message above
Example request
Delete API key
POST /api/contract-sub-provider/user/apikey/remove
Content-Type: application/json
Auth: Wallet personal-message signature
Message to sign
Request body
address
String
Yes
Sui wallet address
apiKey
String
Yes
API key to delete
timestamp
Number
Yes
Unix time in milliseconds
signature
String
Yes
Wallet signature of the message above
Example request
Example response
Sample signature code
Node.js
Python
Java
Cautions
After creating an API key, avoid trading on the web UI with the same account.
Currently limited to 1 API key per account.
The API secret is shown only at creation time and cannot be retrieved later. Delete and recreate if lost.
If you see
USER_NOT_EXIST, connect your wallet and sign in at https://astros.ag before applying for an API key.New keys require manual review (typically 1–2 business days) before trading is enabled.
Request signing (HMAC)
Private REST and WebSocket calls use HMAC-SHA256 with app_secret as the key. The signature is a lowercase hex string.
Java example
String to sign
Do not include the
signaturefield itself.For query / form params, sort parameter names ascending and join as
key=valuewith&.Spaces in parameter values are included as-is.
Treat all values as strings when building the payload to sign.
POST application/json
Exact JSON body string (no extra spaces if your client minifies)
POST application/x-www-form-urlencoded
Sorted key=value&... string
GET query string
Everything after ? (sorted params recommended)
JSON body example
Form / query example
Response status
HTTP uses standard status codes.
Response body:
error
false on success
code
200 on success; any other value is an error
msg
Human-readable status
data
Payload
sid
Request / trace id
Any code other than 200 indicates an error with a corresponding message.
Last updated