# Writes and idempotency

> Idempotency-Key on every POST, expected revision, pausing the AI on a fan.

URL : https://docs.fanconvert.ai/en/api/rest/ecritures

## Idempotency-Key [#idempotency-key]

Every `POST` requires an **`Idempotency-Key`** header: 8 to 128 characters `A-Z a-z 0-9 _ . : -`, a UUID for example.

- Replaying the same key with the same request returns **the same response without a second write** (header `Idempotent-Replayed: true`), for 24 h.
- The same key for another request answers `422`.
- `PUT` and `DELETE` are idempotent by nature.

## The team note [#the-team-note]

Writing the note requires the revision you read (`expectedRevision`): a concurrent write answers `409`. Read the fan again, then write.

## Pause the AI on a fan (MYM) [#pause-the-ai-on-a-fan-mym]

It is the same action as « Arrêter le chatting » (Stop chatting) in the dashboard: the creator's fan filter. Two cases answer `409` and must be done from the dashboard, because they go beyond this fan:

- a creator who answers everyone (the action would change her mode);
- the last fan of an allow list (removing it would cut off the whole creator).

```bash
curl -X POST https://app.fanconvert.ai/public/v1/creators/emma-demo/conversations/123/ai/pause \
  -H "Authorization: Bearer $FANCONVERT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

`…/ai/resume` hands the fan back to the AI (« Relancer le chatting »).

