# Add my reaction (idempotent per user/target/text)

`POST /api/reaction`

URL: https://repsona.com/api/post-reaction

## Request body

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `targetType` | body | project \| taskComment \| noteComment \| user \| activity \| introduction | required | Type of the target the reaction is attached to. |
| `targetId` | body | integer | required | ID of the target (a project, comment, user, and so on, depending on `targetType`). |
| `text` | body | string | required | Reaction text, usually a single emoji (up to 64 characters, surrounding whitespace is trimmed). |

## Request

```sh
curl -X POST "https://<space>.repsona.com/api/reaction" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "targetType": "noteComment",
    "targetId": 36,
    "text": "👍"
  }'
```

## Responses

- 200: Updated reaction list
- 400: Empty or too long text
- 401: Authentication is required
- 403: Not a project member
- 404: Target not found

## Example response

```json
{
  "reactions": [
    {
      "text": "👍",
      "count": 1,
      "byMe": true
    }
  ]
}
```
