Skip to Content
Docs

Idempotency

Send a paid call again after a network error without paying twice.

A network error can hide whether Awen received your call. The Idempotency-Key header makes a retry safe: Awen runs a call once per key, and answers a repeat with the first result.

curl https://app.awen.ai/api/v1/create_with_awen \
  -H "Authorization: Bearer $AWEN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: lookbook-cover-2026-11-21" \
  -d '{"project_id": "<project_id>", "prompt": "A lookbook cover"}'

Rules

  • create_with_awen requires it. A call without it answers 400 with idempotency_key_required.
  • import_file accepts it. Other operations that cannot be replayed, such as enhance, refuse it.
  • A key is yours. It is matched per member, so two people can use the same value.
  • Use a new key for each new request. A UUID is a good choice. A key is 1 to 128 letters, digits, ., _, : or -.
  • Same key, same request. A repeat with the same key and the same body answers the first turn. The same key with a different body answers 400 with invalid_request.

On this page