Staking APIs
API Reference
Overview

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:

HeaderRequiredDescription
X-API-KEY✅ YesYour YGG-provided API key
Content-Type✅ YesMust 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:

CodeHTTP StatusDescription
UNAUTHORIZED401Invalid or missing API key
FORBIDDEN403Access denied
BAD_REQUEST400Invalid wallet address format
BAD_REQUEST400Invalid request parameters
NOT_FOUND404Data not found
RATE_LIMIT_EXCEEDED429Rate limit exceeded
INTERNAL_SERVER_ERROR500Internal 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: 1699564800

Best 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: