📦 Ship to Production — app9.2
Developer CourseModule 9: Ship to Productionapp9.2
Reading10 min

API Keys: eat_test_ vs eat_live_ and RBAC Roles

📦 Module 9: Ship to Production

API Keys: eat_test_ vs eat_live_ and RBAC Roles

Two prefixes. Two completely different worlds.

Test vs Live Keys

PrefixEnvironmentWhat It HitsSafe to Experiment?
eat_test_SandboxSimulated devices, fake dataYes. Break things.
eat_live_ProductionReal meters, real batteries, real moneyNo. Be careful.

The platform is designed so your code stays identical. Only the key changes.

# Development — sandbox
export EAT_API_KEY="eat_test_abc123def456"

# Production — real devices at Khazna
export EAT_API_KEY="eat_live_xyz789ghi012"

# Same script, both environments
python3 battery_optimizer.py

The 5 RBAC Roles

Every API key is tied to a role. Each role has different permissions.

RoleRead DataDispatchSettle / AttestManage UsersManage Billing
adminYesYesYesYesYes
operatorYesYesYesNoNo
viewerYesNoNoNoNo
developerYesSandbox onlySandbox onlyNoNo
agentYesNoNoNoNo

Which Role for Which App?

  • Monitoring dashboard that only reads data? Use viewer.
  • Battery dispatch automation? Use operator.
  • MCP agent that only answers questions? Use agent.
  • Your development sandbox? Use developer.
  • Never use `admin` unless you are managing users or billing.

The Golden Rule

Never commit a live key to git. Not once. Not even "temporarily."

# .env file (git-ignored)
EAT_API_KEY=eat_live_abc123

# .gitignore
.env
# In your code
import os
api_key = os.environ["EAT_API_KEY"]  # Never hardcoded

If you push eat_live_ to GitHub, rotate the key immediately from the API Keys page. DEWA does not care that it was an accident.

Log in to track your progress and earn certifications.