🌾 Farm Overview
HappyHarvest.fun is designed to teach you how to work with JWT authentication, API rate limiting, and proper client-server communication. Your goal is to write a farming script that maintains a high water collection score by correctly calling our API endpoints.
💧 Water Collection Rules
-
Call
/collect
once every 30 seconds to collect 1 water - JWT tokens expire every 5 minutes - you must refresh them
- Multiple calls within 30 seconds = water waste (water decreases by 10)
- Miss a 30-second window without calling = 0 water for that window
- Maximum water capacity: 1024
- Claim land with 5 water, then expand your farming territory!
- Land expansions get increasingly expensive - invest wisely!
- Plant crops with water (costs have tripled!) - but they grow 3x faster!
- Maintain perfect timing to maximize your water collection - it's more critical than ever!
🔄 Farm Flow
🚜 Register Farmer
Call /register
with your farmer name to get unique
API credentials (client_id and client_secret).
🔑 Get JWT Token
Use your credentials to call /auth/token
and
receive a JWT token that expires in 5 minutes.
💧 Collect Water
Call /collect
with your JWT token once every 30
seconds to collect water. Time it perfectly!
🏞️ Claim Land
Once you have 5 water, claim your first plot of land with
/claimLand
to start your farming empire!
🏗️ Expand Territory
Use /expandLand
to grow your farm from 1×1 to
32×32. Each expansion gets more expensive but gives you more
land!
🌾 Plant Crops
Use /plant
to plant crops on your land. Each crop
costs water and has different grow times and market values!
🌟 Harvest for Credits
Wait for crops to mature, then use /harvest
to
collect credits. Monitor market prices for maximum profit!
⏰ Maintain Auth
Refresh your JWT token every 5 minutes and keep your water collection, planting, and harvesting loops running to climb the credits leaderboard.
🔌 API Endpoints
Purpose: Register your farmer and get API credentials
⚠️ Important: One-Time Registration Only!
You can only call /register
once with any farmer name to receive your
credentials. If you call it again with the same name, you'll get
an error and
cannot retrieve your original credentials. Make
sure to save your client_id
and
client_secret
safely!
Body:
Success Response:
Error Response (duplicate name):
Purpose: Get a JWT access token (expires in 5 minutes)
Body:
Response:
Purpose: Collect water for your farm (call once per 30 seconds)
Headers:
Success Response:
Penalty Response (too frequent):
Water Tank Full Response (at capacity):
Purpose: View your farmer profile and stats
Headers:
Response:
Purpose: Update your farmer profile information
Headers:
Body (all fields optional):
Success Response:
Purpose: Claim your first plot of farming land (costs 5 water)
Headers:
Success Response:
Error Response (insufficient water):
Purpose: Plant crops on your claimed land (costs water)
Headers:
Body:
Success Response:
Error Response (insufficient water):
Error Response (invalid coordinates):
Purpose: Harvest mature crops for credits
Headers:
Body:
Success Response:
Error Response (crop not mature):
Error Response (no crop found):
Purpose: Expand your farming territory (increasingly expensive)
Headers:
Success Response:
Expansion Cost Formula:
Purpose: View any player's farming land (public, no authentication required)
Examples:
🎨 Visual Land Viewer:
💡 The /view endpoint shows a beautiful visual color grid of the player's farm!
Response (land claimed):
Response (no land claimed):
Purpose: View your own farming land and what's on it
Headers:
Response (land claimed):
Response (no land):
Purpose: View current farmer rankings (no authentication required)
Response:
Purpose: Get comprehensive crop data with real-time market pricing (no authentication required)
🚨 NEW: Dynamic Market Pricing! This endpoint now provides live market prices that fluctuate ±15% every minute, plus market statistics and timing info for strategic farming decisions.
Response:
🚀 Script Usage Example:
💡 Key Fields for Market Trading:
Purpose: View recent farm activities across all players (no authentication required)
Response:
💡 Use Case: Perfect for monitoring farm activity, seeing what other players are doing, and getting inspiration for your own farming strategy. Activities include water collection milestones, land claims/expansions, crop planting, and harvesting.
Purpose: Test endpoint for JWT authentication (protected)
Headers:
Response:
💡 Use Case: Useful for testing your JWT authentication flow and verifying that your tokens are working correctly before making more complex API calls.
Purpose: Server health check (no authentication required)
Response:
💡 Use Case: Perfect for monitoring scripts to check if the API server is running and responsive before attempting to make authenticated requests.
💡 Strategy Tips
🎯 Perfect Timing
The key to success is timing your /collect
calls
exactly 30 seconds apart. Too frequent = penalty, too slow =
missed opportunities.
⚠️ Token Management
JWT tokens expire every 5 minutes. Make sure to refresh your token before it expires, or your increment calls will fail with a 401 error.
🔄 Robust Error Handling
Implement proper error handling for network issues, token expiration, and rate limiting. The most reliable scripts handle edge cases gracefully.
🏞️ Land Investment Strategy
Land claiming costs 5 water, but expansions get expensive quickly: 1×1→2×2 costs 30 water, 2×2→3×3 costs 100 water, etc. Plan your land investments carefully - balance water collection with land expansion!
🌾 Crop Farming Strategy
Once you have land, you can plant crops for credits! Each crop now has tripled water costs but grows 3x faster - creating a high-intensity farming environment. Water efficiency is more critical than ever! 🚨 NEW: Dynamic Pricing! Crop prices now fluctuate ±15% every minute, adding market timing to your strategy. Check out our comprehensive Crop Guide for detailed information, updated efficiency comparisons, and new market timing strategy tips for this dynamic farming environment!
💻 Your Challenge
🧠 Time to Code!
Now that you understand the API and rules, it's time to build your own script or application! Use any programming language or tool you're comfortable with to create a client that:
- Registers your player to get unique credentials
- Manages JWT token authentication and renewal every 5 minutes
- Calls the increment endpoint with perfect timing (once every 30 seconds)
- Handles errors, token expiration, and rate limiting gracefully
- Runs continuously to maximize your score over time
Hint: The API documentation above shows you exactly what each endpoint expects. Think about timing, error handling, and state management. Good luck climbing the leaderboard! 🚀
⚡ Pro Tips
• Test your timing carefully - use precise intervals (not just
sleep/setTimeout)
• Handle network failures and retry logic
• Monitor token expiration and refresh proactively
• Log your activity to debug issues
• Start simple, then optimize for reliability
🚀 Ready to Play?
🏁 Getting Started
Now that you understand the rules and API, build your script and deploy it! Watch the leaderboard to see your progress and compete with other players.
Pro tip: Start simple and add features like better error handling, logging, and monitoring as you go. The most reliable scripts win!