Skip to main content
POST
/
api
/
v1
/
session
/
approve
Approve Spending
curl --request POST \
  --url https://api.mor.org/api/v1/session/approve \
  --header 'Authorization: <authorization>'
{
  "success": true,
  "transaction_hash": "<string>",
  "amount": "<string>"
}
Approve the contract to spend MOR tokens on your behalf. Connects to the proxy-router’s /blockchain/approve endpoint. For creating sessions, approve enough tokens by calculating: bid_price * session_duration. Uses the DIAMOND_CONTRACT_ADDRESS environment variable as the spender contract address.

Headers

Authorization
string
required
API key in format: Bearer sk-xxxxxx

Query Parameters

amount
integer
required
The amount to approve. Consider bid price × duration for sessions.

Response

success
boolean
Whether the approval was successful
transaction_hash
string
Blockchain transaction hash
amount
string
Approved amount
Calculating approval amount:
  1. Get the bid price from /api/v1/models/ratedbids?model_id=0x...
  2. Decide on session duration (e.g., 3600 seconds)
  3. Calculate: amount = bid_price * session_duration
  4. Add a buffer for safety: amount = amount * 1.1
This operation requires you to have a private key registered. Use the /api/v1/auth/private-key endpoint to store your encrypted private key first.