API Reference
This section provides detailed documentation for all YGG Staking API endpoints.
Available Endpoints
Get Stake Snapshots
Retrieve user's staking history and 7-day average staked amount.
- Endpoint: Get Stake Snapshots
- Method: GET
- URL:
/api/staking/snapshots - Use Case: Query user staking data when player logs in to determine tier and rewards
Base URL
⚠️
YGG_API_BASE_URL: The base URL is provided during integration.
⚠️
Production and Staging environments use different base URLs, API KEYS, and SHARED SECRETS.
Common Request Headers
All API requests require the following headers:
| Header | Required | Description |
|---|---|---|
X-API-KEY | ✅ Yes | Your YGG-provided API key |
Content-Type | ✅ Yes | Must be application/json |
Common Response Format
Error Response
{
"success": false,
"code": "ERR-CODE",
"message": "Human-readable error description"
}Error Codes
Common error codes across all endpoints:
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Invalid or missing API key |
FORBIDDEN | 403 | Access denied |
BAD_REQUEST | 400 | Invalid wallet address format |
BAD_REQUEST | 400 | Invalid request parameters |
NOT_FOUND | 404 | Data not found |
RATE_LIMIT_EXCEEDED | 429 | Rate limit exceeded |
INTERNAL_SERVER_ERROR | 500 | Internal server error |
Rate Limiting
⏱️
Rate limits apply to all endpoints. Contact YGG for your specific rate limits during integration.
Rate Limit Headers
When rate limited, you'll receive:
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1699564800Best Practices
Caching
💾
Cache staking data for the duration of a player session to minimize API calls. Refresh on next login.
Testing
🧪
Test your integration with various scenarios:
- Valid wallet address with staking history
- Valid wallet address with no staking data
- Invalid wallet address format
- Missing or invalid API key
Next Steps
Explore the API endpoint documentation:
- Get Stake Snapshots - Detailed endpoint documentation