Network calls fail and get retried. To make a call exactly-once, send an Idempotency-Key header:
curl https://api.fetchbean.com/v1/search \
-H "Authorization: Bearer $FETCHBEAN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 9f8c1e2a-..." \
-d '{"query":"best vector databases"}'
Use a unique key per logical operation (a UUID is ideal). If you retry with the same key:
- The original call already succeeded → you get its result back, and you are not charged again.
- The original call is still in flight → you get a
request_in_progress response instead of a second run.
- The original call failed → the key is spent; start a fresh call with a new key.
If you omit the header, fetchbean generates a unique key for you, so every call is treated as distinct.
Idempotency protects the billing too: a reserved call holds credits up front and settles once. A same-key retry
never reserves or charges a second time.