Create a new question for a component item
Creates a new question for a component item within a project component. Questions capture customer-specific requirements or project details in a structured way, making work packages flexible and reusable.
What are Questions? Questions are form fields attached to component items (typically Work Packages) that help capture customer requirements or project details. They make work packages flexible and reusable by allowing later individualization in projects. When customers answer questions, the answers can automatically affect effort calculation and pricing.
Question Types: Each question can have one of eight types, each suited for different data collection needs:
- ShortText: Single-line text input for names, titles, keywords, or short answers
- Editor: Formatted multi-line text for descriptions, detailed explanations, or free text answers
- Checkbox: Yes/No selection or multiple checkbox options. Answers can impact effort calculation if options have extraHours configured
- Radio: Single choice from multiple predefined options. Answers can impact effort calculation if options have extraHours configured
- Files: Upload files such as logos, documents, graphics, or reference materials
- Datepicker: Select a date for deadlines, delivery dates, or scheduling
- Multiplier: Dynamic calculation based on quantity. For example, “How many pages?” with a duration per page. The system calculates: Answer (quantity) × Duration per element = Total additional effort
- Person: Select one or more people from the project team or clients
Key Features:
- Automatic Effort Calculation: Answers to Checkbox, Radio, and Multiplier questions can automatically affect the project effort and pricing
- Conditional Visibility: Questions can have conditions that control when they are shown (e.g., only show if another question was answered a certain way)
- Flexible Options: Checkbox and Radio questions support multiple options, each with optional extraHours that affect effort calculation
Validation Rules: For Checkbox and Radio question types, at least one option must be provided in the options array. The description field accepts HTML or Markdown input and is automatically converted to IDoc format for storage.
Automatic Processing: After creating a question, the system automatically:
- Assigns a sort order (max existing sort + 1) to position the question in the list
- Recalculates all conditions to ensure dependent items are shown/hidden correctly
- Updates timeframes if the question affects effort calculation
- Triggers summary generation if needed
Use Case: Use questions to create dynamic, customer-specific project configurations. For example, ask “Do you need e-commerce functionality?” and automatically add extra work packages or adjust pricing based on the answer.
/projects/{projectId}/items/{itemId}/questionsAuthorizationOAuth2 access token · headerrequiredapi:writeAuthorizationBearer token (JWT) · headerrequiredprojectIdstringrequireditemIdstringrequiredfieldsToReturnstringresponseShapestringcompactfullLT-Response-Shapestringfullapplication/jsonconditionsCreateComponentItemConditionDto[]Show propertiesHide properties
CreateComponentItemConditionDtocontainsTypestringSomeAlltargetQuestionIdstringtargetTestCaseIdstringtargetTodoIdstringtargetValuestringtypestringrequiredQuestionAnsweredQuestionNotAnsweredQuestionAnswerContainsQuestionAnswerDoesNotContainQuestionAnswerEqualQuestionAnswerDoesNotEqualTodoIsDoneTodoIsNotDoneTestCasePassedTestCaseFaileddescriptionstringrequiredmultiplierValuenumberoptionsCreateQuestionOptionDto[]Show propertiesHide properties
CreateQuestionOptionDtoextraHoursnumbertitlestringrequiredquestionstringrequiredtitlestringrequiredtypestringrequiredShortTextEditorCheckboxRadioFilesDatepickerMultiplierPersonidstringcurl -X POST "https://leadtime.app/api/public/projects/a47dc37b-7693-4d06-b49c-17084b773aff/items/e57dc37b-7693-4d06-b49c-17084b773aff/questions" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"conditions": [
{
"containsType": "Some",
"targetQuestionId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetTestCaseId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetTodoId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetValue": "Yes",
"type": "QuestionAnswered"
}
],
"description": "<p>This question helps us understand performance requirements.</p>",
"multiplierValue": 1.5,
"options": [
{
"extraHours": 2.5,
"title": "Option A"
}
],
"question": "Please specify the expected response time",
"title": "What is the expected performance?",
"type": "ShortText"
}'const response = await fetch("https://leadtime.app/api/public/projects/a47dc37b-7693-4d06-b49c-17084b773aff/items/e57dc37b-7693-4d06-b49c-17084b773aff/questions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"conditions": [
{
"containsType": "Some",
"targetQuestionId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetTestCaseId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetTodoId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetValue": "Yes",
"type": "QuestionAnswered"
}
],
"description": "<p>This question helps us understand performance requirements.</p>",
"multiplierValue": 1.5,
"options": [
{
"extraHours": 2.5,
"title": "Option A"
}
],
"question": "Please specify the expected response time",
"title": "What is the expected performance?",
"type": "ShortText"
})
});import requests
response = requests.post(
"https://leadtime.app/api/public/projects/a47dc37b-7693-4d06-b49c-17084b773aff/items/e57dc37b-7693-4d06-b49c-17084b773aff/questions",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"conditions": [
{
"containsType": "Some",
"targetQuestionId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetTestCaseId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetTodoId": "e57dc37b-7693-4d06-b49c-17084b773aff",
"targetValue": "Yes",
"type": "QuestionAnswered"
}
],
"description": "<p>This question helps us understand performance requirements.</p>",
"multiplierValue": 1.5,
"options": [
{
"extraHours": 2.5,
"title": "Option A"
}
],
"question": "Please specify the expected response time",
"title": "What is the expected performance?",
"type": "ShortText"
},
){
"id": "e57dc37b-7693-4d06-b49c-17084b773aff"
}