# How to handle a refused write in your own client

A write with no valid pass is refused. Your client should treat that as a signal to get a pass, then retry the write. Do not treat it as a permanent failure on the first response.

In a browser, the usual answer is HTTP `403` with `error` set to `attackfee_required` and a fresh work challenge. Solve the challenge, `POST /v1/redeem`, and send the write again with the pass in the `Authorization: Attackfee` header or the `attackfee-pass` field. On a page that already loaded `attackfee.js`, `attackfee.fetch` does that retry once for an in-page request.

If the client sends `Attackfee-Client: agent` and the site offers payment, the issuer can answer HTTP `402` with a payment offer and a link to the work challenge. Complete a payment and redeem, or do the work instead, then retry the write. If there is no offer, an agent also gets `403`. The official `@attackfee/agent` helper `createAgent` already solves and retries once after a `402` or `403`.

Other answers mean something else. `429` on a challenge is a rate limit, with `retry-after` of 60 seconds. `503` means the pass store is down, and protected writes fail closed. `timeout-or-duplicate` from siteverify means the pass expired, was used up, or was sent again. Get a new pass. People never pay money in a browser. Current prices for the paid path are at `/v1/price`.

## Where Attackfee fits

See [What happens if a write has no pass?](/learn/concepts/what-happens-without-a-pass), [What Attackfee HTTP statuses mean](/learn/concepts/what-attackfee-http-statuses-mean), and [How agents write to an Attackfee site](/learn/agents/how-agents-write-to-an-attackfee-site). Official steps are in the [ask docs](/docs/ask).

- [Attackfee](/)
- [Learn](/learn)
- [Concepts](/learn/concepts)
- [How to handle a refused write in your own client](/learn/concepts/how-to-handle-a-refused-write-in-your-own-client)

## Related

- [What happens if a write has no pass?](/learn/concepts/what-happens-without-a-pass)
- [What Attackfee HTTP statuses mean](/learn/concepts/what-attackfee-http-statuses-mean)
- [What Attackfee error codes mean](/learn/concepts/what-attackfee-error-codes-mean)
- [How agents write to an Attackfee site](/learn/agents/how-agents-write-to-an-attackfee-site)
- [How to solve a work challenge in Node](/learn/agents/how-to-solve-a-work-challenge-in-node)
- [How does a paid write work?](/learn/payments/how-does-a-paid-write-work)
- [How to test a write without a pass](/learn/concepts/how-to-test-a-write-without-a-pass)
- [Agent calls](/docs/ask)

## Questions



### "What does a browser client see?"

"A write with no valid pass gets 403 and error attackfee_required, with a fresh challenge. Solve the challenge, redeem a pass, and retry the write with the pass."

### "What does an agent see?"

"If the site offers payment, an agent that sends Attackfee-Client: agent can get 402 with a payment offer and a link to the work challenge. Otherwise the agent also gets 403."

### "Does the official agent SDK retry for me?"

"createAgent solves and retries once after a 402 or 403. In a page, attackfee.fetch retries a 403 with attackfee_required and a challenge once."

### "How do I test a refused write?"

"Send the write without a pass, or use the documented test header on the demo. Expect 403, or 402 for an agent when payment is offered."
