Create Earn Event
Send raw event data to Absinthe, which will then be processed by your custom business rules to generate points for users.
Conceptual Overview
Think of this as a two-step process:
- Send Raw Data: Use this API to report that something happened (e.g., "user killed 5 monsters", "user minted 3 NFTs", "user scored 1,250 points in leaderboard")
- Rules Processing: Absinthe applies your configured business rules to convert this raw data into points (e.g., "5 monsters Γ 10 points each = 50 points", "3 NFTs Γ bonus multiplier = 75 points")
Example Event Types
- Gaming: Monsters killed, levels completed, achievements unlocked
- DeFi: Tokens swapped, liquidity provided, transactions completed
- Social: Posts created, likes received, referrals made
- Commerce: Items purchased, reviews written, loyalty actions
API Details
- Endpoint:
https://gql3.absinthe.network/api/rest/earn-event
- Method:
POST
- Auth: Authorization header (API key generated per campaign)
- Payload: Raw event data β not processed points
Authorization
Authorization: Bearer \<YOUR_API_KEY>
Sending Event Data
curl -X POST https://gql3.absinthe.network/api/rest/earn-event \
-H "Authorization: Bearer \<YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"account_id": "0x123",
"amount": 15,
"identity_type": "EVM_ADDRESS",
"reg_event_id": "9bb4c38c-c3e9-4d74-a8c4-f617ccd9aa4a"
}'
Real-world Examples
curl -X POST https://gql3.absinthe.network/api/rest/earn-event \
-H "Authorization: Bearer \<YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"account_id": "player123@email.com",
"amount": 25, // 25 monsters killed this session
"identity_type": "EMAIL",
"reg_event_id": "monsters-killed-event-id"
}'
curl -X POST https://gql3.absinthe.network/api/rest/earn-event \
-H "Authorization: Bearer \<YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"account_id": "0xABC123...",
"amount": 1500.50, // $1,500.50 in trading volume
"identity_type": "EVM_ADDRESS",
"reg_event_id": "trading-volume-event-id"
}'
How Rules Convert Data to Points
After you send raw event data, Absinthe processes it through your configured rules:
Raw Event: "User killed 15 monsters"
β
Business Rule: "1 monster = 10 points, with 2x multiplier for 10+ monsters"
β
Final Points: (15 Γ 10) Γ 2 = 300 points awarded
Raw Event: "User traded $1,500 volume"
β
Business Rule: "Every $100 volume = 5 points, max 100 points per day"
β
Final Points: min(1500/100 Γ 5, 100) = 75 points awarded
Behavior Rules
Identity Types
Enum value | Description / Example |
---|---|
EVM_ADDRESS | 0xB58621209Dc0b0c514E52a6D9A165a16ae95e4f7 |
SOLANA_ADDRESS | 8ZUkk8pTyEAjyHbmBBXdrDNiNZ9D9Gcn5HgqxEjD8aHn |
BTC_ADDRESS | 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa |
EMAIL | user@example.com |
DISCORD_PROVIDER_ID | Numericβe.g., 99242147425040394 |
X_PROVIDER_ID | Numeric Twitter IDβe.g., 1517923606637912064 |
GITHUB_PROVIDER_ID | Numeric GitHub IDβe.g., 9912345 |
Parameters
Field | Type | Notes |
---|---|---|
account_id | string | Target identity (see table above) |
identity_type | enum | One of the identity types |
amount | numeric | Raw event value (monsters killed, volume traded, etc.) |
reg_event_id | uuid | Unique event reference for idempotency |
Error Handling
All requests return 200 OK. Check the top-level errors[]
array for GraphQL failures:
{
"data": null,
"errors": [
{
"message": "invalid identity_type",
"extensions": { "code": "validation-failed" }
}
]
}
FAQ
What's the difference between event data and points?
Event data is raw metrics (15 monsters killed, $500 traded). Points are the processed output after your business rules are applied (15 monsters β 150 points via your multipliers).
Can I send the same event multiple times?
Yes. Each call logs a new event occurrence. If a user kills 10 monsters, then later kills 5 more, send two separate events with amount: 10
and amount: 5
.
How do I set up the business rules?
Configure your rules in the Absinthe dashboard under Rules Engine. Define how raw event values should be converted to points, including multipliers, caps, and conditions.
Why separate raw data from points calculation?
This architecture lets you change your point economics without losing historical data. You can adjust multipliers, add seasonal bonuses, or implement complex rules while preserving the original event log.