# Vote on a change

`PUT /api/v1/changelog-entries/{entry}/vote`

Say whether you like a change.

You hold one vote per change, so voting the other way replaces the first vote. The id of the vote is the identifier of the change. A direction other than up or down answers 422 on direction.

## Parameters

- `entry` (string, required): The identifier of the change, the 26 characters it reports as id. A change that does not exist or is not published yet answers 404.
- `direction` (string, required): up or down.

## Returns

The vote object. A change that does not exist answers 404.

- `data` (object): The vote.
- `data.type` (string): Always changelog_vote. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.
- `data.id` (string): The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.
- `data.attributes` (object): Everything the record holds.
- `data.attributes.direction` (string): up or down.
- `data.attributes.updated_at` (timestamp): When the vote was last cast, as a count of seconds since 1970.

## Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in `X-RateLimit-Remaining`.

## Request

```sh
curl https://my.monicahq.com/api/v1/changelog-entries/01M7NBFWK5XNH908RFDGEAJXKN/vote \
  -X PUT \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "direction": "up"
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/changelog-entries/01M7NBFWK5XNH908RFDGEAJXKN/vote', {
  method: 'PUT',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    direction: 'up',
  }),
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->put('https://my.monicahq.com/api/v1/changelog-entries/01M7NBFWK5XNH908RFDGEAJXKN/vote', [
    'direction' => 'up',
]);
```

## Response

`200`

```json
{
    "data": {
        "type": "changelog_vote",
        "id": "01M7NBFWK5XNH908RFDGEAJXKN",
        "attributes": {
            "direction": "up",
            "updated_at": 1794823200
        }
    }
}
```
