Skip to main content

Claim Season Tokens

Generates an EIP-712 signature payload. The user presents this signature to the on-chain contract to claim their season token reward.

The endpoint is idempotent — repeated calls with the same (user, distribution, nonce) return the same signature.

POST /points/claim/:distribution_id
Authorization: Bearer <token>

Path Parameters

ParameterTypeDescription
distribution_idUUIDDistribution record ID (the id field from GET /points/distribution/:season_id)

Request Body

None.

Response

{
"user": "0xabcd...1234",
"distribution_id": "f1e2d3c4-...",
"amount": "805.00",
"nonce": 1,
"deadline": 1741132800,
"signature": "0x4a5b6c...f0a1b2",
"domain": {
"name": "AXBlade Points Distribution",
"version": "1",
"chain_id": 1,
"verifying_contract": "0xContractAddress..."
}
}

The response is a flat structure (no nested eip712_payload). amount is human-readable (not wei) — the contract converts to 18-decimal precision on-chain. deadline is a Unix timestamp in seconds.

Response Fields

FieldTypeDescription
userstringUser's wallet address
distribution_idstringDistribution record UUID
amountDecimalToken amount to claim (human-readable)
nonceintEIP-712 nonce
deadlineintClaim deadline (Unix seconds)
signaturestringBackend-signed EIP-712 signature
domain.namestringEIP-712 domain name
domain.versionstringEIP-712 domain version
domain.chain_idintChain ID
domain.verifying_contractstringOn-chain verifying contract address

EIP-712 Struct

ClaimPointsRewards(
address user,
uint256 distributionId,
uint256 amount,
uint256 nonce,
uint256 deadline
)
  • distributionId — big-endian uint256 representation of the distribution UUID
  • amount — converted to 18-decimal wei for on-chain verification
  • Signature expires at claim_deadline (claim_status becomes expired after that)
  • After on-chain confirmation: claim_status → claimed, claimed_at and claim_tx_hash are filled in

Error Codes

CodeDescription
FORBIDDENDistribution record does not belong to the current user
NOT_FOUNDDistribution record not found
ALREADY_CLAIMEDAlready claimed
EXPIREDPast the claim deadline
SIGNER_UNAVAILABLEBackend signing key not configured
SIGN_FAILEDSigning failed

Code Examples

Python

import requests

BASE_URL = "https://api.primit.io/api/v1"
JWT_TOKEN = "your_jwt_token"
DISTRIBUTION_ID = "f1e2d3c4-..."

resp = requests.post(
f"{BASE_URL}/points/claim/{DISTRIBUTION_ID}",
headers={"Authorization": f"Bearer {JWT_TOKEN}"},
)
data = resp.json()

print(f"Amount: {data['amount']} tokens")
print(f"Signature: {data['signature']}")
print(f"Deadline: {data['deadline']} (unix)")
# Pass data to on-chain contract to complete the claim