Vote
Cast a vote on a project analysis to track team investment decisions. Votes are tied to a specific analysis and attributed to a team member, enabling consensus tracking and decision documentation.
Endpoint
POST https://api.kruncher.ai/api/integration/project/vote
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Your API key (format: YOUR_API_KEY) |
Content-Type | Yes | Must be application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
projectId | string (UUID) | Yes | The project to vote on |
analysisId | string (UUID) | Yes | The analysis this vote is for |
votingcustomeruserId | string (UUID) | Yes | The user casting the vote |
newVote | object | Yes | The vote details |
newVote.votescoreId | string (UUID) | Yes | The vote score to assign |
newVote.comment | string | No | Comment explaining the vote |
Code Examples
JavaScript/TypeScript
Basic
const API_KEY = "YOUR_API_KEY_HERE";
const BASE_URL = "https://api.kruncher.ai/api/integration";
const headers = {
"Authorization": API_KEY,
"Content-Type": "application/json"
};
const response = await fetch(`${BASE_URL}/project/vote`, {
method: "POST",
headers,
body: JSON.stringify({
projectId: "521a93a6-091d-4943-ba13-7c1a654a14ae",
analysisId: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
votingcustomeruserId: "b2c3d4e5-f6a7-8901-bcde-f12345678901",
newVote: {
votescoreId: "c3d4e5f6-a7b8-9012-cdef-123456789012"
}
})
});
if (!response.ok) {
throw new Error(`Failed to cast vote: ${response.statusText}`);
}
const result = await response.json();
console.log("Vote recorded:", result.data);Python
Basic
import requests
API_KEY = "YOUR_API_KEY_HERE"
BASE_URL = "https://api.kruncher.ai/api/integration"
headers = {
"Authorization": API_KEY,
"Content-Type": "application/json"
}
response = requests.post(
f"{BASE_URL}/project/vote",
headers=headers,
json={
"projectId": "521a93a6-091d-4943-ba13-7c1a654a14ae",
"analysisId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"votingcustomeruserId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"newVote": {
"votescoreId": "c3d4e5f6-a7b8-9012-cdef-123456789012"
}
}
)
response.raise_for_status()
result = response.json()
print("Vote recorded:", result["data"])cURL
Basic
curl -X POST "https://api.kruncher.ai/api/integration/project/vote" \
-H "Authorization: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"projectId": "521a93a6-091d-4943-ba13-7c1a654a14ae",
"analysisId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"votingcustomeruserId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"newVote": {
"votescoreId": "c3d4e5f6-a7b8-9012-cdef-123456789012"
}
}'Response Structure
Success Response (200 OK)
Returns the project vote summary after recording the vote.
{
"metadata": {
"code": "1000",
"title": "Successful",
"description": ""
},
"data": {
"totalVotes": 3,
"votes": [
{
"votescoreId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"comment": "Strong team with proven track record.",
"customerUser": {
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"fullName": "John Smith"
}
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
totalVotes | number | Total number of votes on this project |
votes | array | Individual vote records |
votes[].votescoreId | string | The score ID that was assigned |
votes[].comment | string | Comment provided with the vote |
votes[].customerUser | object | The user who cast the vote |
votes[].customerUser.id | string | User ID |
votes[].customerUser.fullName | string | User display name |
Error Responses
400 Bad Request
{
"metadata": {
"code": "102",
"title": "Error",
"description": "Invalid input parameter"
}
}Returned when required fields are missing or not valid UUIDs.
401 Not Authorized
{
"metadata": {
"code": "106",
"title": "Error",
"description": "Not authorized to access this project"
}
}404 Not Found
{
"metadata": {
"code": "122",
"title": "Error",
"description": "API key not found"
}
}Related Endpoints
- Full Report - View the vote summary alongside project details
- Retrieve Companies - Get project and analysis IDs
- Add Comment - Add discussion notes without voting
- Company Report - Get the analysis being voted on
Last updated on