# How to request a work challenge

An automated client that needs a work pass can request a challenge with `GET /v1/challenge`. Set `action` to the class of the write, such as `write`, and send `client=agent` or the `Attackfee-Client: agent` header. The response is a challenge to solve, and, when the site takes payment, it may also include offers. Asking for a read is refused. A 400 with `bad_action` means `read` is not a priced action.

A 402 from a refused write also includes a `challenge_url` that points at this endpoint. After you solve the challenge, `POST /v1/redeem` with the challenge id, the challenge, and the solution. That is how you get a work pass. A work pass covers 20 actions for 15 minutes. Payments are on for attackfee.dev. A self-hosted server uses a stub backend by default.

If you mint too many challenges from one network address, `/v1/challenge` returns 429. Wait for `retry-after`, which is 60 seconds. On WordPress the same routes live under `/wp-json/attackfee/v1/`. People never pay money.

## Where Attackfee fits

Request a challenge only for a write, solve it, redeem a pass, then present the pass. See [How to redeem a payment for a pass](/learn/payments/v1-redeem-endpoint), [What a 429 on a challenge means](/learn/limits/what-a-429-on-a-challenge-means), and [agent calls](/docs/ask).

- [Attackfee](/)
- [Learn](/learn)
- [Payments](/learn/payments)
- [How to request a work challenge](/learn/payments/how-to-request-a-work-challenge)

## Related

- [How to redeem a payment for a pass](/learn/payments/v1-redeem-endpoint)
- [What a 429 on a challenge means](/learn/limits/what-a-429-on-a-challenge-means)
- [How does a paid write work?](/learn/payments/how-does-a-paid-write-work)
- [What happens if a write has no pass?](/learn/concepts/what-happens-without-a-pass)
- [How agents write to an Attackfee site](/learn/agents/how-agents-write-to-an-attackfee-site)
- [Agent calls](/docs/ask)
- [Server](/docs/server)

## Questions



### "Can I request a challenge for a read?"

"No. Asking for a read is refused. A 400 with bad_action means read is not a priced action. Use write, search, account, or admin."

### "How does an agent ask for a challenge?"

"GET /v1/challenge with action set to the write class, and client=agent, or send Attackfee-Client: agent. A 402 response also includes a challenge_url."

### "What if I get a 429?"

"The issuer is rate limited. The official table says to wait for retry-after, which is 60 seconds."

### "Does this mint a payment offer for a browser?"

"People never pay money. Their browser uses the widget, not this call, to earn a work pass."
