Skip to Content
Docs are evolving — expect frequent updates.

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

HeaderRequiredDescription
AuthorizationYesYour API key (format: YOUR_API_KEY)
Content-TypeYesMust be application/json

Request Body

FieldTypeRequiredDescription
projectIdstring (UUID)YesThe project to vote on
analysisIdstring (UUID)YesThe analysis this vote is for
votingcustomeruserIdstring (UUID)YesThe user casting the vote
newVoteobjectYesThe vote details
newVote.votescoreIdstring (UUID)YesThe vote score to assign
newVote.commentstringNoComment explaining the vote

Code Examples

JavaScript/TypeScript

CODE
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

CODE
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

CODE
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.

CODE
{
  "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

FieldTypeDescription
totalVotesnumberTotal number of votes on this project
votesarrayIndividual vote records
votes[].votescoreIdstringThe score ID that was assigned
votes[].commentstringComment provided with the vote
votes[].customerUserobjectThe user who cast the vote
votes[].customerUser.idstringUser ID
votes[].customerUser.fullNamestringUser display name

Error Responses

400 Bad Request

CODE
{
  "metadata": {
    "code": "102",
    "title": "Error",
    "description": "Invalid input parameter"
  }
}

Returned when required fields are missing or not valid UUIDs.

401 Not Authorized

CODE
{
  "metadata": {
    "code": "106",
    "title": "Error",
    "description": "Not authorized to access this project"
  }
}

404 Not Found

CODE
{
  "metadata": {
    "code": "122",
    "title": "Error",
    "description": "API key not found"
  }
}

Last updated on