> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suggestkit.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Vote

> Create a vote for a specific suggestion

Create a vote for a specific suggestion. This allows users to upvote feature requests and show support for specific suggestions.

<ParamField path="id" type="string" required>
  ID of the suggestion to vote for (CUID format, e.g., clm7x1a2b000008l7h3k1b2c3)
</ParamField>

<ParamField body="userId" type="string" required>
  ID of the user creating the vote
</ParamField>

## Response Fields

| Field        | Type   | Required | Description                             |
| ------------ | ------ | -------- | --------------------------------------- |
| id           | string | Yes      | Unique vote identifier (auto-generated) |
| suggestionId | string | Yes      | ID of the suggestion voted for          |
| userId       | string | Yes      | ID of the user who voted                |
| createdAt    | string | Yes      | Vote creation timestamp (ISO 8601)      |
| updatedAt    | string | Yes      | Last update timestamp (ISO 8601)        |

## Example Request

```json theme={null}
{
  "userId": "clm7x1a2b000008l7h3k1b2c3"
}
```

## Example Response

```json theme={null}
{
  "id": "clm7x1a2b000008l7h3k1b2c3",
  "suggestionId": "clm7x1a2b000008l7h3k1b2c3",
  "userId": "clm7x1a2b000008l7h3k1b2c3",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-15T10:30:00.000Z"
}
```

## Validation Rules

* **One vote per user per suggestion**: Users cannot vote multiple times on the same suggestion
* **Valid IDs**: userId must exist in the project
* **Active records**: Cannot vote on deleted suggestions or users

## Error Responses

| Status Code | Description                        | Example Response                                         |
| :---------- | :--------------------------------- | :------------------------------------------------------- |
| 400         | User already voted or missing data | `{"error": "User has already voted on this suggestion"}` |
| 401         | Unauthorized - Invalid API key     | `{"error": "Unauthorized"}`                              |
| 404         | Suggestion or user not found       | `{"error": "Suggestion not found"}`                      |
| 500         | Internal server error              | `{"error": "Failed to create vote"}`                     |
