ID of the suggestion to vote for (CUID format, e.g., clm7x1a2b000008l7h3k1b2c3)
ID of the user creating the vote
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
Example Response
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"} |