跳到主要内容

Unbind Referral Code

Remove the current user's binding to their referrer.

POST /v1/referral/unbind
Authorization: Bearer <token>
Content-Type: application/json

Request Body​

{
"signature": "0x...",
"timestamp": 1772010600
}
FieldTypeRequiredDescription
signaturestringNoEIP-712 signature — accepted for forward compatibility, not verified
timestampuint64NoUnix timestamp (seconds) — accepted for forward compatibility, not verified

The backend currently ignores the request body entirely (an empty body is accepted); the caller is identified solely by the session Bearer token.

EIP-712 Signature​

Not verified by the backend at present; retained for forward compatibility.

TypeHash: UnbindReferralCode(address wallet,uint256 timestamp)
{
"primaryType": "UnbindReferralCode",
"types": {
"UnbindReferralCode": [
{ "name": "wallet", "type": "address" },
{ "name": "timestamp", "type": "uint256" }
]
},
"message": {
"wallet": "0x<your_address>",
"timestamp": 1772010600
}
}

Response​

{
"success": true,
"previous_referrer": "0x29f721b203a9fc9c5dde35a739d8b8e0e4605489",
"previous_code": "4DDDC2D4"
}
FieldTypeDescription
successboolWhether unbinding succeeded
previous_referrerstring | nullThe previous referrer's wallet address (null if the referrer's session had no wallet address)
previous_codestringThe previously bound referral code

Error Codes​

Error format. Referral endpoints return errors as a plain-text body (text/plain) containing the message shown in the Message column, not a JSON object. A missing or invalid Authorization: Bearer session token returns 401 with missing bearer token / invalid session.

HTTPMessageDescription
401missing bearer token / invalid sessionMissing, expired or revoked session token
404not bound to a referrerUser is not currently bound to any referrer
500(database error text)Server error

Code Examples​

Python​

import time, requests
from eth_account import Account
from eth_account.messages import encode_typed_data

BASE_URL = "https://api.rocky.exchange"
JWT_TOKEN = "your_jwt_token"
PRIVATE_KEY = "your_private_key"

wallet = Account.from_key(PRIVATE_KEY)
timestamp = int(time.time())

typed_data = {
"types": {
"EIP712Domain": [
{"name": "name", "type": "string"},
{"name": "version", "type": "string"},
{"name": "chainId", "type": "uint256"},
],
"UnbindReferralCode": [
{"name": "wallet", "type": "address"},
{"name": "timestamp", "type": "uint256"},
],
},
"primaryType": "UnbindReferralCode",
"domain": {"name": "Rocky", "version": "1", "chainId": 43114},
"message": {"wallet": wallet.address, "timestamp": timestamp},
}

signable = encode_typed_data(full_message=typed_data)
signed = wallet.sign_message(signable)

resp = requests.post(
f"{BASE_URL}/v1/referral/unbind",
headers={"Authorization": f"Bearer {JWT_TOKEN}", "Content-Type": "application/json"},
json={"signature": signed.signature.hex(), "timestamp": timestamp},
)
print(resp.json())
# {"success": true, "previous_referrer": "0x29f7...5489", "previous_code": "4DDDC2D4"}