Skip to content

Authentication

Every request requires a bearer API key, passed in the Authorization header:

Authorization: Bearer <YOUR_API_KEY>

Requests without a valid, active key return 401 Unauthorized.

Every account must configure an IP whitelist before the API key can be used. On the first request, create the key and add your current egress IP in the panel under IP Whitelist. Requests that don’t come from an allowed IP return 403 with a message about the whitelist.

All generation endpoints accept an optional Idempotency-Key header. Replaying the same key returns the original job_id without creating a duplicate job or charging again.

Idempotency-Key: 9f1c8b1e-7c2a-4a86-9b6e-2c5fa0b7d8e1
Terminal window
curl -s -X POST https://api.moonez.ai/api/v1/text-generations \
-H "Authorization: Bearer $API_KEY" \
-H "Idempotency-Key: 9f1c8b1e-7c2a-4a86-9b6e-2c5fa0b7d8e1" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a red panda astronaut floating in a nebula",
"aspect_ratio": "16:9",
"resolution": "2K"
}'