CLI API
How the CLI Works
Here's the full flow the official Anagrama CLI uses to authenticate and play the daily puzzle:
1
Authenticate
The CLI starts the Device Code Flow. The user approves via their browser, and the CLI receives a cli_ token.
2
Fetch today's puzzle
The CLI calls GET /anagrama/api/puzzle to get the scrambled letters and session state.
3
Submit guesses
When the user types a guess, the CLI sends POST /anagrama/api/guess. The server responds with correct or wrong.
4
Use hints (optional)
If the user requests a hint, the CLI calls POST /anagrama/api/hint to reveal a letter.
5
Get the answer
Once the puzzle is done (solved or failed), GET /anagrama/api/reveal returns the answer.
Full example
bash
# 1. CLI starts the auth flow
curl -X POST https://api.playanagrama.com/cli/auth/start \
-H "Content-Type: application/json" \
-d '{"label":"MacBook Pro","clientName":"anagrama-cli"}'
# => { "device_code": "dvc_abc", "verification_url": "https://...", ... }
# 2. User visits the URL and approves. Poll until complete:
curl -X POST https://api.playanagrama.com/cli/auth/poll \
-H "Content-Type: application/json" \
-d '{"device_code":"dvc_abc"}'
# => { "status": "approved", "token": "cli_xxx", ... }
# 3. Fetch today's puzzle
TOKEN="cli_xxx"
curl https://api.playanagrama.com/anagrama/api/puzzle \
-H "Authorization: Bearer $TOKEN"
# => { "scramble": "NOCIS", "length": 5, ... }
# 4. Submit a guess
curl -X POST https://api.playanagrama.com/anagrama/api/guess \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"word":"coins"}'
# => { "result": "correct", "answer": "COINS", "solved": true }Was this page helpful?