Zum Inhalt springen
Leadtime
Deutsch
Esc
navigateopen⌘Jpreview

Answer a question in a project component item

Submits an answer to a question within a project component item. This endpoint allows users to provide answers to questions that capture customer requirements or project details.

Question Types and Answer Formats: Questions can have different types, and each type requires a specific answer format. Only provide the answer field(s) relevant to the question type:

  • ShortText: Provide shortTextAnswer (string)
  • Editor: Provide editorAnswer (HTML or Markdown string)
  • Checkbox: Provide selectedOptions (array of option IDs for multiple selections)
  • Radio: Provide selectedOption (single option ID string)
  • Files: Provide fileUrls (array of file URL strings)
  • Datepicker: Provide dateAnswer (ISO 8601 date string)
  • Multiplier: Provide multiplierAnswer (number)
  • Person: Provide selectedPersonId (array of person IDs)

Automatic Processing: When you submit an answer, the system automatically:

  • Tracks who answered (answeredBy is set to the current user)
  • Records when the answer was provided (answeredAt timestamp)
  • Calculates the isAnswered flag based on whether a valid answer was provided
  • Updates option selections for Checkbox/Radio types (marks options as selected)
  • Recalculates project conditions to show/hide dependent items based on the answer
  • Updates effort calculations if the question affects pricing (for Checkbox/Radio/Multiplier types)
  • Updates timeframes if effort changed

Permissions: This endpoint uses the processComponentsQuestions permission, which is more permissive than manageComponents. This allows users to answer questions and participate in project configuration without requiring full component edit access.

POST/projects/{projectId}/items/{itemId}/questions/{id}/answer
Authorization
AuthorizationOAuth2 access token · headerrequired
Scopes:api:write
or
AuthorizationBearer token (JWT) · headerrequired
Path parameters
projectIdstringrequired
Project UUID
itemIdstringrequired
Component Item UUID
idstringrequired
Question UUID
Request body
requiredapplication/json
dateAnswerstring
Date answer for Datepicker question type (ISO 8601 format)
editorAnswerstring
Rich text answer for Editor question type (HTML or Markdown format)
fileUrlsstring[]
Array of file URLs for File question type
multiplierAnswernumber
Numeric multiplier answer for Number question type
selectedOptionstring
Single selected option ID for Radio question type
selectedOptionsstring[]
Array of selected option IDs for Checkbox question type (multiple selections)
selectedPersonIdstring[]
Array of person IDs for Person question type
shortTextAnswerstring
Short text answer for ShortText question type
Responses
200Question answered successfully
400Invalid request: invalid UUID format, invalid date format, or invalid option IDs
401Unauthorized - Invalid or missing authentication token
403Insufficient permissions (processComponentsQuestions) or access to project denied
404Question not found or question does not belong to the component item in the project
Request
curl -X POST "https://leadtime.app/api/public/projects/a47dc37b-7693-4d06-b49c-17084b773aff/items/d47dc37b-7693-4d06-b49c-17084b773aff/questions/e57dc37b-7693-4d06-b49c-17084b773aff/answer" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "dateAnswer": "2024-12-31T00:00:00.000Z",
  "editorAnswer": "<p>This is a <strong>rich text</strong> answer</p>",
  "fileUrls": [
    "https://example.com/file1.pdf",
    "https://example.com/file2.jpg"
  ],
  "multiplierAnswer": 2.5,
  "selectedOption": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "selectedOptions": [
    "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "b2c3d4e5-f6g7-8901-bcde-f12345678901"
  ],
  "selectedPersonId": [
    "e57dc37b-7693-4d06-b49c-17084b773aff"
  ],
  "shortTextAnswer": "This is my answer"
}'
Response
Question answered successfully