> Documentation index: https://docs.dev.repp.co.il/llms.txt - fetch it to find every page of these docs.

# Actions

An action does exactly what the same step does on the site, under the site's own rules: the account sees it there, and the other side is notified as if it was done on the site. Each one is marked **Changes something** in its section.

**Actions**

| Endpoint | What it does | MCP tool |
| --- | --- | --- |
| [`PUT /v1/me/looking-for-work`](https://docs.dev.repp.co.il/looking-for-work.md) | Looking for work | `set_looking_for_work` |
| [`POST /v1/open-classes/{id}/offer`](https://docs.dev.repp.co.il/offer.md) | Offer on a class | `offer_on_class` |
| [`DELETE /v1/open-classes/{id}/offer`](https://docs.dev.repp.co.il/withdraw-offer.md) | Take an offer back | `withdraw_offer` |
| [`POST /v1/requests`](https://docs.dev.repp.co.il/post-request.md) | Post a request | `post_request` |
| [`POST /v1/bookings/{id}/decision`](https://docs.dev.repp.co.il/booking-decision.md) | Answer a space request | `decide_booking` |
| [`POST /v1/ratings`](https://docs.dev.repp.co.il/rate.md) | Rate | `rate` |

> **Note:** **No action moves money, with one exception.** No key can pay, book a space, choose an offer, cancel or charge a card: those stay on the site. The exception: declining a space request refunds the trainer by the site's rules, as declining it on the site does.

## Who may act

Only a **read-and-actions** key (see [Authentication](https://docs.dev.repp.co.il/authentication.md)), or an app signed in with `repp.write`. Any other key gets `403 read_only_key` (over [MCP](https://docs.dev.repp.co.il/mcp.md), the spec's `403 insufficient_scope`). An action for a business with a key whose account has no business gets `403 not_a_business`, and one for a trainer `403 not_a_trainer`.

## Sending it once: Idempotency-Key

- Send an `Idempotency-Key` header with every action: any text up to 200 characters, a new one per action (a UUID is good).
- **A repeat gets the first answer**: if the network drops and you send the same action with the same key again, it is done once and you get what the first one answered.
- The same key with a **different** action (another endpoint) answers `409 idempotency_conflict`, and nothing is done.
- On the same endpoint the first answer comes back **whatever the body**: never reuse a key for a new action.
- A key is remembered per API key. Without the header every request is a new action.

```bash
IDEMPOTENCY_KEY=$(uuidgen)  # send the same one again to retry this action
curl -X PUT "https://api.dev.repp.co.il/v1/me/looking-for-work" \
  -H "Authorization: Bearer $REPP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -d '{
  "on": true
}'
```

## Limits

**30 actions a minute** per key (`429 too_many_requests`, `Retry-After: 60`) and **200 a day** (`429 too_many_actions`; reads go on). Actions count toward the key's 120 requests a minute too. See [Rate limits](https://docs.dev.repp.co.il/rate-limits.md).

## When the site says no

An action the site's rules refuse answers `409 action_refused`, with the site's own refusal in `reason` - a fixed `snake_case` word such as `class_not_available`, `already_offered` or `booking_not_available`. Branch on `reason`; the `message` is for people.

```json
{
  "error": {
    "code": "action_refused",
    "message": "האתר לא אישר את הפעולה. הסיבה כתובה ב-reason.",
    "reason": "class_not_available"
  }
}
```

**Errors of actions**

| Status | Code | Meaning |
| --- | --- | --- |
| 403 | `read_only_key` | The key only reads. Actions need a key made with "read and actions" (or an app signed in with the scope repp.write). |
| 400 | `bad_body` | The request body is not a JSON object (or a field in it is missing or malformed). The message names it. |
| 409 | `action_refused` | The site's own rules refused the action; `reason` says which (for example class_not_available, already_offered, booking_not_available). |
| 409 | `idempotency_conflict` | The Idempotency-Key was already used by this key for a different action. |
| 429 | `too_many_actions` | The key ran 200 actions in the last 24 hours. Reads still work. |
