{"openapi":"3.1.0","info":{"title":"ListenIQ Local API","version":"0.1.0","description":"Contract for the current private-alpha local routes. Session-cookie routes and the demonstration bearer token are development controls, not a production OAuth implementation."},"servers":[{"url":"http://localhost:3000","description":"Local Next.js application"}],"tags":[{"name":"Authentication"},{"name":"Onboarding"},{"name":"Administration"},{"name":"Surveys"},{"name":"Responses"},{"name":"Research"},{"name":"Workflows"},{"name":"Audience"},{"name":"Participants"},{"name":"Safety"},{"name":"Jobs"},{"name":"Library"},{"name":"Developer"},{"name":"Contract"}],"paths":{"/api/auth/session":{"post":{"tags":["Authentication"],"operationId":"createSession","summary":"Create a private-alpha browser session","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionCredentials"}}}},"responses":{"200":{"description":"Session created","headers":{"Set-Cookie":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Authentication"],"operationId":"deleteSession","summary":"Clear the browser session","responses":{"200":{"description":"Session cleared","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}}}}},"/api/admin/invitations":{"get":{"tags":["Administration"],"operationId":"listWorkspaceAccess","summary":"List members and sanitized workspace invitations","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Workspace access register","content":{"application/json":{"schema":{"type":"object","required":["members","invitations"],"properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceMember"}},"invitations":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceInvitation"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Administration"],"operationId":"createWorkspaceInvitation","summary":"Create an expiring one-time workspace invitation","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkspaceInvitation"}}}},"responses":{"201":{"description":"Invitation created and one-time acceptance URL returned","headers":{"Location":{"schema":{"type":"string","format":"uri"}}},"content":{"application/json":{"schema":{"type":"object","required":["invitation","token","acceptanceUrl"],"properties":{"invitation":{"$ref":"#/components/schemas/WorkspaceInvitation"},"token":{"type":"string","writeOnly":true},"acceptanceUrl":{"type":"string","format":"uri","writeOnly":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/admin/invitations/{id}/revoke":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Workspace invitation identifier"}],"post":{"tags":["Administration"],"operationId":"revokeWorkspaceInvitation","summary":"Revoke a pending workspace invitation","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Invitation revoked","content":{"application/json":{"schema":{"type":"object","required":["invitation"],"properties":{"invitation":{"$ref":"#/components/schemas/WorkspaceInvitation"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/admin/retention":{"get":{"tags":["Administration"],"operationId":"getRetentionPolicy","summary":"Read the local workspace retention review policy","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Current retention review policy","content":{"application/json":{"schema":{"type":"object","required":["retentionPolicy"],"properties":{"retentionPolicy":{"$ref":"#/components/schemas/RetentionPolicy"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Administration"],"operationId":"updateRetentionPolicy","summary":"Change the local review-only retention schedule","description":"Private Alpha control. The mutation changes review scheduling and never deletes records.","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionPolicyChange"}}}},"responses":{"200":{"description":"Retention review schedule updated without deletion","content":{"application/json":{"schema":{"type":"object","required":["retentionPolicy","effect"],"properties":{"retentionPolicy":{"$ref":"#/components/schemas/RetentionPolicy"},"effect":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/admin/activity-export":{"post":{"tags":["Administration"],"operationId":"exportWorkspaceActivity","summary":"Export the local audit register as formula-neutralized CSV","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Quoted activity CSV","headers":{"Content-Disposition":{"schema":{"type":"string"}},"X-ListenIQ-Export-Event-Count":{"schema":{"type":"integer"}}},"content":{"text/csv":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/admin/devices/{id}/revoke":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Registered local mobile installation identifier"}],"post":{"tags":["Administration"],"operationId":"revokeRegisteredMobileDevice","summary":"Block a registered installation from future local synchronization","description":"The local denylist does not send a remote wipe command.","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceRevocation"}}}},"responses":{"200":{"description":"Device sync blocked","content":{"application/json":{"schema":{"type":"object","required":["device","effect"],"properties":{"device":{"$ref":"#/components/schemas/RegisteredMobileDevice"},"effect":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/admin/devices/enrollments":{"post":{"tags":["Administration"],"operationId":"createMobileFieldDeviceEnrollment","summary":"Create a short-lived one-use field-device enrollment","description":"Binds one installation to an exact signed survey version and active collector. The opaque token is returned once.","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileFieldEnrollmentInput"}}}},"responses":{"201":{"description":"One-use enrollment created","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileFieldEnrollmentResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/mobile/devices/enroll":{"post":{"tags":["Administration"],"operationId":"redeemMobileFieldDeviceEnrollment","summary":"Redeem a one-use enrollment and receive protected device credentials","description":"The credential and signed assignment pack are returned on first enrollment and on an exact recoverable retry of the same token, installation, app version and public-key thumbprint. Changed reuse returns 409. No authentication or identity assurance beyond the one-use token is claimed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileDeviceEnrollmentRequest"}}}},"responses":{"200":{"description":"Exact installation enrollment retry recovered without a second device or audit mutation","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileDeviceEnrollmentResult"}}}},"201":{"description":"Installation enrolled","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileDeviceEnrollmentResult"}}}},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/mobile/devices/{id}/bootstrap":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/MobileDeviceIdHeader"}],"get":{"tags":["Administration"],"operationId":"getMobileFieldDevicePolicy","summary":"Refresh a signed assignment or owner revocation","security":[{"fieldDeviceCredential":[]}],"responses":{"200":{"description":"Current signed device assignment","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["device","assignmentPack"],"properties":{"device":{"$ref":"#/components/schemas/RegisteredMobileDevice"},"assignmentPack":{"$ref":"#/components/schemas/SignedMobileAssignmentPack"}}}}}},"403":{"$ref":"#/components/responses/Error"}}}},"/api/mobile/devices/{id}/responses":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/MobileDeviceIdHeader"}],"post":{"tags":["Responses"],"operationId":"submitMobileFieldDeviceResponse","summary":"Submit one exact version-bound offline response","description":"Requires source=offline and the assigned survey, version and collector. Exact idempotent replay is stable; changed reuse returns 409.","security":[{"fieldDeviceCredential":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseSubmission"}}}},"responses":{"200":{"description":"Exact accepted replay","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseSubmissionResult"}}}},"201":{"description":"Response accepted","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseSubmissionResult"}}}},"400":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/invitations/{token}/accept":{"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","minLength":48},"description":"Opaque one-time invitation token"}],"post":{"tags":["Authentication"],"operationId":"acceptWorkspaceInvitation","summary":"Accept a valid invitation and provision the named identity","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptWorkspaceInvitation"}}}},"responses":{"201":{"description":"Invitation accepted","content":{"application/json":{"schema":{"type":"object","required":["member","identity"],"properties":{"member":{"$ref":"#/components/schemas/WorkspaceMember"},"identity":{"enum":["managed","local_private_alpha"]}}}}}},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"502":{"$ref":"#/components/responses/Error"}}}},"/api/onboarding":{"post":{"tags":["Onboarding"],"operationId":"completeWorkspaceOnboarding","summary":"Create one invited member's first editable study and completion record atomically","description":"Local Private Alpha setup only. This operation does not publish, distribute or contact respondents.","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/OnboardingIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceOnboardingInput"}}}},"responses":{"200":{"description":"Exact replay returned the original first study","headers":{"Cache-Control":{"schema":{"const":"no-store"}},"Location":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceOnboardingResult"}}}},"201":{"description":"First study and onboarding record created","headers":{"Cache-Control":{"schema":{"const":"no-store"}},"Location":{"schema":{"type":"string","pattern":"^/app/studies/study-[0-9a-f-]{36}/edit$"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceOnboardingResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"}}}},"/api/openapi.json":{"get":{"tags":["Contract"],"operationId":"getOpenApiDocument","summary":"Read the small runtime-advertised API contract","responses":{"200":{"description":"OpenAPI document","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/health":{"get":{"tags":["Contract"],"operationId":"getLiveness","summary":"Check process liveness","responses":{"200":{"description":"Process is live","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/api/ready":{"get":{"tags":["Contract"],"operationId":"getReadiness","summary":"Check persistence readiness and seeded resource counts","responses":{"200":{"description":"Service is ready","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Readiness"}}}},"503":{"description":"Persistence is not ready","content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"const":"not_ready"}}}}}}}}},"/api/developer/applications":{"get":{"tags":["Developer"],"operationId":"listLocalDeveloperApplications","summary":"List sanitized local Private Alpha developer applications","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Sanitized local applications","content":{"application/json":{"schema":{"type":"object","required":["applications"],"properties":{"applications":{"type":"array","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Developer"],"operationId":"registerLocalDeveloperApplication","summary":"Register a local application and return one-time credentials","description":"Private Alpha only. This is not production OAuth client registration.","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["name","redirectUri","scopes"],"properties":{"name":{"type":"string","minLength":3,"maxLength":100},"redirectUri":{"type":"string","format":"uri"},"scopes":{"type":"array","minItems":1,"uniqueItems":true,"items":{"enum":["surveys:read","webhooks:test","mcp:invoke"]}}}}}}},"responses":{"201":{"description":"Application registered with one-time client and webhook secrets","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/developer/applications/{id}/authorize":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Local developer application identifier"}],"post":{"tags":["Developer"],"operationId":"approveLocalDeveloperApplicationScopes","summary":"Approve exact scopes and mint a two-minute one-use local authorization code","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["redirectUri","scopes"],"properties":{"redirectUri":{"type":"string","format":"uri"},"scopes":{"type":"array","items":{"enum":["surveys:read","webhooks:test","mcp:invoke"]}}}}}}},"responses":{"200":{"description":"One-use local authorization code","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/developer/token":{"post":{"tags":["Developer"],"operationId":"exchangeLocalDeveloperAuthorizationCode","summary":"Exchange a one-use code for a ten-minute scoped local bearer token","description":"ListenIQ Local Authorization Grant. OAuth-style field names are used for local SDK ergonomics, but this endpoint is not production OAuth 2.0 or OIDC.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["grant_type","client_id","client_secret","code","redirect_uri"],"properties":{"grant_type":{"const":"authorization_code"},"client_id":{"type":"string"},"client_secret":{"type":"string","writeOnly":true},"code":{"type":"string","writeOnly":true},"redirect_uri":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Short-lived local bearer token","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/developer/webhook-receiver":{"post":{"tags":["Developer"],"operationId":"receiveLocalSignedWebhook","summary":"Verify and idempotently receive a loopback HMAC webhook","parameters":[{"name":"X-ListenIQ-Application-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-ListenIQ-Signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Verified duplicate event acknowledged without a second effect"},"202":{"description":"Signed event verified and accepted"},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"$ref":"#/components/responses/Error"},"503":{"description":"Intentional first-attempt local retry exercise"}}}},"/api/developer/applications/{id}/journey":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Local developer application identifier"}],"post":{"tags":["Developer"],"operationId":"runLocalDeveloperJourney","summary":"Run the bounded local API, signed webhook retry and authorized MCP journey","security":[{"localAuthorizationGrant":["surveys:read","webhooks:test","mcp:invoke"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"surveyId":{"type":"string","default":"study-member-voice"}}}}}},"responses":{"200":{"description":"Structured standalone local journey evidence","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/surveys":{"post":{"tags":["Surveys"],"operationId":"createSurveyDraft","summary":"Create an editable survey from an original starting point","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStudyRequest"}}}},"responses":{"201":{"description":"Survey draft created","headers":{"Location":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["survey"],"properties":{"survey":{"$ref":"#/components/schemas/SurveyDraft"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"get":{"tags":["Surveys"],"operationId":"getSurveyDraft","summary":"Read an editable survey draft","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Survey draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SurveyDraft"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Surveys"],"operationId":"replaceSurveyDraft","summary":"Replace an editable survey draft","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SurveyDraft"}}}},"responses":{"200":{"description":"Updated survey draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SurveyDraft"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/surveys/{id}/approval":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"post":{"tags":["Collaboration"],"operationId":"actOnSurveyApproval","summary":"Request or decide approval for the current survey revision","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SurveyApprovalAction"}}}},"responses":{"200":{"description":"Approval decided","content":{"application/json":{"schema":{"type":"object","required":["approval"],"properties":{"approval":{"$ref":"#/components/schemas/SurveyApprovalRequest"}}}}}},"201":{"description":"Approval requested","content":{"application/json":{"schema":{"type":"object","required":["approval"],"properties":{"approval":{"$ref":"#/components/schemas/SurveyApprovalRequest"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/reviews":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"post":{"tags":["Collaboration"],"operationId":"createSurveyReviewItem","summary":"Add a comment or suggestion to the current survey revision","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SurveyReviewItemInput"}}}},"responses":{"201":{"description":"Review item created","content":{"application/json":{"schema":{"type":"object","required":["item"],"properties":{"item":{"$ref":"#/components/schemas/SurveyReviewItem"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/surveys/{id}/reviews/{reviewId}":{"parameters":[{"$ref":"#/components/parameters/SurveyId"},{"name":"reviewId","in":"path","required":true,"schema":{"type":"string"},"description":"Survey review item identifier"}],"patch":{"tags":["Collaboration"],"operationId":"resolveSurveyReviewItem","summary":"Resolve a comment or accept a suggestion as review guidance","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["action"],"properties":{"action":{"const":"resolve"}}}}}},"responses":{"200":{"description":"Review item resolved","content":{"application/json":{"schema":{"type":"object","required":["item"],"properties":{"item":{"$ref":"#/components/schemas/SurveyReviewItem"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/surveys/{id}/quiz-assessments":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"get":{"tags":["Surveys"],"operationId":"getProtectedQuizAssessment","summary":"Read protected quiz keys for the exact current draft revision","description":"Authorized editor route backed by a mode-0600 server sidecar. Correct-answer identifiers are never part of SurveyDraft or PublishedVersion.","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Protected assessment view","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["assessment"],"properties":{"assessment":{"$ref":"#/components/schemas/QuizKeyEditorView"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/Error"}}},"put":{"tags":["Surveys"],"operationId":"putProtectedQuizAssessment","summary":"Save protected quiz keys against the exact current draft revision","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuizKeyInput"}}}},"responses":{"200":{"description":"Protected assessment and updated revision-bound survey saved","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["assessment","survey"],"properties":{"assessment":{"$ref":"#/components/schemas/QuizKeyEditorView"},"survey":{"$ref":"#/components/schemas/SurveyDraft"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/publish":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"post":{"tags":["Surveys"],"operationId":"publishSurvey","summary":"Compile and publish an immutable survey version","security":[{"sessionCookie":[]}],"responses":{"201":{"description":"Published","content":{"application/json":{"schema":{"type":"object","required":["version"],"properties":{"version":{"$ref":"#/components/schemas/PublishedVersion"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/export":{"parameters":[{"$ref":"#/components/parameters/SurveyId"},{"name":"format","in":"query","schema":{"enum":["repeating_rows"]},"description":"When omitted, returns the standard wide response CSV."},{"name":"questionId","in":"query","schema":{"type":"string"},"description":"Required with format=repeating_rows. Returns one normalized CSV line per nested row."}],"get":{"tags":["Surveys"],"operationId":"exportSurveyResponsesCsv","summary":"Export survey responses as CSV","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"CSV export","headers":{"Content-Disposition":{"schema":{"type":"string"}}},"content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/surveys/{id}/collector":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"patch":{"tags":["Surveys"],"operationId":"updateWebCollector","summary":"Update the canonical web collector access controls","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectorPatch"}}}},"responses":{"200":{"description":"Collector updated","content":{"application/json":{"schema":{"type":"object","required":["collector"],"properties":{"collector":{"$ref":"#/components/schemas/Collector"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/surveys/{id}/distribution":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"get":{"tags":["Distribution"],"operationId":"getCollectorDistributionKit","summary":"Read the governed local distribution kit for a signed study","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Distribution kit and signed version summary","content":{"application/json":{"schema":{"type":"object","required":["distribution","signedVersion"],"properties":{"distribution":{"oneOf":[{"$ref":"#/components/schemas/DistributionView"},{"type":"null"}]},"signedVersion":{"$ref":"#/components/schemas/SignedVersionSummary"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Distribution"],"operationId":"registerDistributionContacts","summary":"Register a privacy-minimized governed contact list","description":"Stores only a keyed email digest and masked display value. No external message is sent.","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistributionContactsInput"}}}},"responses":{"200":{"description":"Exact idempotent replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistributionOperationResult"}}}},"201":{"description":"Governed contacts registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistributionOperationResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/distribution/schedule":{"parameters":[{"$ref":"#/components/parameters/SurveyId"},{"$ref":"#/components/parameters/IdempotencyKey"}],"post":{"tags":["Distribution"],"operationId":"scheduleDistributionKit","summary":"Schedule local invitation, reminder and completion-triggered thank-you phases","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistributionScheduleInput"}}}},"responses":{"200":{"description":"Schedule created or exact replay returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistributionOperationResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/distribution/run":{"parameters":[{"$ref":"#/components/parameters/SurveyId"},{"$ref":"#/components/parameters/IdempotencyKey"}],"post":{"tags":["Distribution"],"operationId":"runDistributionPhase","summary":"Run one deterministic local delivery phase without external sends","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistributionRunInput"}}}},"responses":{"200":{"description":"Sandbox phase processed or exact replay returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistributionOperationResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/distribution/export":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"get":{"tags":["Distribution"],"operationId":"exportDistributionAnalytics","summary":"Export masked distribution analytics as formula-safe CSV","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Formula-safe masked CSV","headers":{"Content-Disposition":{"schema":{"type":"string"}}},"content":{"text/csv":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/distribution/invites/{token}/opt-out":{"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":800},"description":"Purpose-bound governed distribution invitation token"},{"$ref":"#/components/parameters/IdempotencyKey"}],"post":{"tags":["Distribution"],"operationId":"optOutDistributionContact","summary":"Idempotently suppress a governed contact from future phases","responses":{"200":{"description":"Opt-out recorded or exact state replayed","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["ok","duplicate"],"properties":{"ok":{"const":true},"duplicate":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/jobs/distribution":{"get":{"tags":["Jobs"],"operationId":"runScheduledDistributionWorker","summary":"Run the daily PostgreSQL-backed deterministic distribution worker","description":"Vercel Cron invokes this internal route once daily. It processes only due contacts and records an atomic privacy-minimized receipt. The deterministic local adapter performs no external delivery.","security":[{"cronBearer":[]}],"responses":{"200":{"description":"Daily run completed or its exact stored receipt replayed","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["kind","summary"],"properties":{"kind":{"const":"ok"},"summary":{"$ref":"#/components/schemas/DistributionWorkerSummary"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/responses/{responseId}/review":{"parameters":[{"$ref":"#/components/parameters/SurveyId"},{"name":"responseId","in":"path","required":true,"schema":{"type":"string"},"description":"Immutable response identifier"}],"patch":{"tags":["Responses"],"operationId":"reviewSurveyResponse","summary":"Set a separate reversible analysis disposition for a response","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseReviewPatch"}}}},"responses":{"200":{"description":"Review saved","content":{"application/json":{"schema":{"type":"object","required":["review"],"properties":{"review":{"$ref":"#/components/schemas/ResponseReview"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/surveys/{id}/analysis/query":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"post":{"tags":["Research"],"operationId":"querySurveyEvidence","summary":"Ask a bounded question against included survey evidence","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalysisQueryInput"}}}},"responses":{"201":{"description":"Evidence-linked answer recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalysisQueryResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/research/compile":{"post":{"tags":["Research"],"operationId":"compileResearchPlan","summary":"Compile a deterministic fallback research plan","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchBrief"}}}},"responses":{"200":{"description":"Research plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchPlan"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/workflows/{id}/approve":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Workflow run identifier"}],"post":{"tags":["Workflows"],"operationId":"approveWorkflow","summary":"Approve a proposed workflow run","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Approved workflow and idempotently created sandbox case","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowActionResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/workflows/{id}/resolve":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Workflow run identifier"}],"post":{"tags":["Workflows"],"operationId":"resolveWorkflowCase","summary":"Record an outcome on an approved sandbox case","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOutcomeInput"}}}},"responses":{"200":{"description":"Workflow case resolved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowActionResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/audience/budget":{"get":{"tags":["Audience"],"operationId":"getAudienceBudget","summary":"Read the privacy-minimized synthetic research-credit budget","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Synthetic allocation, reservations, estimates and value-free ledger","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["budget"],"properties":{"budget":{"$ref":"#/components/schemas/AudienceBudgetView"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Audience"],"operationId":"setAudienceCreditAllocation","summary":"Set the owner-governed synthetic research-credit allocation","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/AudienceCreditIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceAllocationInput"}}}},"responses":{"200":{"description":"Allocation receipt or exact replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceAllocationResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/audience/orders":{"post":{"tags":["Audience"],"operationId":"createAudienceOrder","summary":"Create a synthetic sandbox audience order with feasibility","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/AudienceCreditIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAudienceOrder"}}}},"responses":{"200":{"description":"Exact draft-order replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceOrderCreationResult"}}}},"201":{"description":"Draft audience order and synthetic credit estimate created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceOrderCreationResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/audience/orders/{id}/approve":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Audience order identifier"}],"post":{"tags":["Audience"],"operationId":"approveAudienceOrder","summary":"Approve an order and idempotently create synthetic assignments","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/AudienceCreditIdempotencyKey"}],"responses":{"200":{"description":"Credits reserved and privacy-minimized assignment count returned, or exact replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceApprovalResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/audience/orders/{id}/cancel":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Audience order identifier"}],"post":{"tags":["Audience"],"operationId":"cancelAudienceOrder","summary":"Cancel completion-free fieldwork and append a compensating synthetic-credit release","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/AudienceCreditIdempotencyKey"}],"responses":{"200":{"description":"Order cancelled and credits released, or exact replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceCancellationResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/participants/{id}/redeem":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Participant identifier"}],"post":{"tags":["Participants"],"operationId":"redeemSandboxReward","summary":"Redeem exactly 100 points through the sandbox voucher adapter","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SandboxRedemption"}}}},"responses":{"200":{"description":"Exact redemption retry returned without a second deduction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedemptionResult"}}}},"201":{"description":"Sandbox redemption posted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedemptionResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/participant-access/{token}/export":{"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":160},"description":"Opaque local Private Alpha participant access token"}],"post":{"tags":["Participants"],"operationId":"exportParticipantActivity","summary":"Export the participant's sanitized local profile and activity record","description":"The path token is a local Private Alpha bearer link, not production participant authentication. Exact retries return the original byte-stable snapshot.","parameters":[{"$ref":"#/components/parameters/ParticipantIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantExportInput"}}}},"responses":{"200":{"description":"Sanitized participant activity export","headers":{"Content-Disposition":{"schema":{"type":"string"}},"X-ListenIQ-Idempotent-Replay":{"schema":{"type":"boolean"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantActivityExport"}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/participant-access/{token}/withdraw":{"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":160},"description":"Opaque local Private Alpha participant access token"}],"post":{"tags":["Participants"],"operationId":"withdrawParticipantMatching","summary":"Withdraw from future participant matching while preserving research and reward records","parameters":[{"$ref":"#/components/parameters/ParticipantIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantWithdrawalInput"}}}},"responses":{"200":{"description":"Exact withdrawal retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantWithdrawalResult"}}}},"201":{"description":"Future matching withdrawn","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantWithdrawalResult"}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/participant-access/{token}/support":{"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":160},"description":"Opaque local Private Alpha participant access token"}],"post":{"tags":["Participants"],"operationId":"createParticipantSupportCase","summary":"Open an auditable local participant support or reward dispute case","parameters":[{"$ref":"#/components/parameters/ParticipantIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantSupportInput"}}}},"responses":{"200":{"description":"Exact support-case retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantSupportResult"}}}},"201":{"description":"Support case created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantSupportResult"}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/library/questions":{"get":{"tags":["Library"],"operationId":"listQuestionLibrary","summary":"List governed reusable-question assets and version audit","description":"Local Private Alpha question library. Production requires an explicitly configured isolated persistence path.","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Question library state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionLibraryState"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Library"],"operationId":"proposeQuestionLibraryAsset","summary":"Propose version one of a reusable scalar question","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionLibraryInput"}}}},"responses":{"201":{"description":"Question version proposed","headers":{"Location":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["asset"],"properties":{"asset":{"$ref":"#/components/schemas/QuestionLibraryAsset"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/library/questions/{id}/versions":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^library-question-[0-9a-f-]{36}$"}}],"post":{"tags":["Library"],"operationId":"proposeQuestionLibraryRevision","summary":"Propose the next immutable version from an approved question","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionLibraryInput"}}}},"responses":{"201":{"description":"Question revision proposed","content":{"application/json":{"schema":{"type":"object","required":["assetId","version"],"properties":{"assetId":{"type":"string"},"version":{"$ref":"#/components/schemas/QuestionLibraryVersion"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/library/questions/{id}/versions/{version}/approve":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^library-question-[0-9a-f-]{36}$"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Library"],"operationId":"approveQuestionLibraryVersion","summary":"Approve and freeze a reusable-question version","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Question version approved or exact approval replay returned","content":{"application/json":{"schema":{"type":"object","required":["assetId","version","duplicate"],"properties":{"assetId":{"type":"string"},"version":{"$ref":"#/components/schemas/QuestionLibraryVersion"},"duplicate":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/library/questions/{id}/versions/{version}/insert":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^library-question-[0-9a-f-]{36}$"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Library"],"operationId":"insertQuestionLibraryVersion","summary":"Copy an approved version into one unpublished draft page","description":"Exact idempotency replay returns the existing cloned question. Reusing a key with a different request returns 409.","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/LibraryIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionLibraryInsertInput"}}}},"responses":{"200":{"description":"Exact insertion replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionLibraryInsertResult"}}}},"201":{"description":"Approved question copied into the draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionLibraryInsertResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/response-imports":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"get":{"tags":["Responses"],"operationId":"listResponseImports","summary":"List governed local response intake batches or download the exact signed-version CSV template","security":[{"sessionCookie":[]}],"parameters":[{"name":"format","in":"query","required":false,"schema":{"enum":["template"]}}],"responses":{"200":{"description":"Sanitized intake register or CSV template","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseImportRegister"}},"text/csv":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Responses"],"operationId":"commitResponseImport","summary":"Atomically commit a fully validated manual or CSV response batch","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/ResponseImportIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseImportInput"}}}},"responses":{"200":{"description":"Exact commit replay","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseImportCommitResult"}}}},"201":{"description":"Validated batch committed","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseImportCommitResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/response-imports/preview":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"post":{"tags":["Responses"],"operationId":"previewResponseImport","summary":"Validate an entire bounded response batch without mutation","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseImportInput"}}}},"responses":{"200":{"description":"Sanitized validation preview with no raw rows","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["preview"],"properties":{"preview":{"$ref":"#/components/schemas/ResponseImportPreview"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/response-imports/{batchId}/rollback":{"parameters":[{"$ref":"#/components/parameters/SurveyId"},{"name":"batchId","in":"path","required":true,"schema":{"type":"string","maxLength":120}}],"post":{"tags":["Responses"],"operationId":"rollbackResponseImport","summary":"Exclude an intake batch through immutable response reviews without deleting source records","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/ResponseImportIdempotencyKey"}],"responses":{"200":{"description":"Batch excluded or deterministic repeat returned","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseImportRollbackResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/dashboard-shares":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"get":{"tags":["Surveys"],"operationId":"listProtectedDashboardShares","summary":"List owner-controlled aggregate dashboard shares and their audit events","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Sanitized share register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardShareRegister"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Surveys"],"operationId":"createProtectedDashboardShare","summary":"Create a password-protected aggregate view fixed to one signed version and segment","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/DashboardShareIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardShareCreateInput"}}}},"responses":{"200":{"description":"Exact creation replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardShareCreateResult"}}}},"201":{"description":"Protected aggregate view created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardShareCreateResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/dashboard-shares/{shareId}/revoke":{"parameters":[{"$ref":"#/components/parameters/SurveyId"},{"name":"shareId","in":"path","required":true,"schema":{"type":"string"}}],"post":{"tags":["Surveys"],"operationId":"revokeProtectedDashboardShare","summary":"Revoke a protected aggregate view and invalidate prior recipient grants","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Protected view revoked","content":{"application/json":{"schema":{"type":"object","required":["share","duplicate"],"properties":{"share":{"$ref":"#/components/schemas/DashboardShare"},"duplicate":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/dashboard-shares/{token}/unlock":{"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","minLength":32,"maxLength":160}}],"post":{"tags":["Surveys"],"operationId":"unlockProtectedDashboardShare","summary":"Unlock an aggregate recipient view with its separately supplied password","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","additionalProperties":false,"required":["password"],"properties":{"password":{"type":"string","format":"password","minLength":12,"maxLength":128,"writeOnly":true}}}}}},"responses":{"303":{"description":"Redirect to the protected recipient view with an indistinguishable success or denial flow","headers":{"Location":{"schema":{"type":"string"}},"Set-Cookie":{"schema":{"type":"string"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/v1/surveys/{id}":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"get":{"tags":["Surveys"],"operationId":"getApiSurvey","summary":"Read a survey and its published version through the developer API","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Survey resource","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SurveyResource"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/v1/responses":{"post":{"tags":["Responses"],"operationId":"submitResponse","summary":"Submit an idempotent response to an immutable survey version","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseSubmission"}}}},"responses":{"200":{"description":"Previously accepted response returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseSubmissionResult"}}}},"201":{"description":"New response accepted","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseSubmissionResult"}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"description":"Non-enumerating unavailable collection response","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/public-abuse/reports":{"post":{"tags":["Safety"],"operationId":"submitPublicAbuseReport","summary":"Submit a privacy-minimized public survey concern without revealing collector existence","description":"The receipt confirms intake only. Reporter identity, source pseudonym, limiter state and collector existence are not returned.","parameters":[{"$ref":"#/components/parameters/PublicAbuseIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicAbuseReportInput"}}}},"responses":{"202":{"description":"Report receipt returned for both known and unknown collector references","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicAbuseReceiptResult"}}}},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/surveys/{id}/abuse-reports":{"parameters":[{"$ref":"#/components/parameters/SurveyId"}],"get":{"tags":["Safety"],"operationId":"listPublicAbuseReports","summary":"List sanitized collector reports for owner or administrator triage","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Sanitized report list","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["reports"],"properties":{"reports":{"type":"array","items":{"$ref":"#/components/schemas/PublicAbuseReport"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Safety"],"operationId":"triagePublicAbuseReport","summary":"Bind an immutable owner review and optional collector pause to one report","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/PublicAbuseIdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicAbuseTriageInput"}}}},"responses":{"200":{"description":"Exact triage replay","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicAbuseTriageResult"}}}},"201":{"description":"Review decision recorded","headers":{"Cache-Control":{"schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicAbuseTriageResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"opaque"},"cronBearer":{"type":"http","scheme":"bearer","bearerFormat":"CRON_SECRET","description":"Server-only Vercel Cron secret. Never expose this credential to a browser or client application."},"fieldDeviceCredential":{"type":"apiKey","in":"header","name":"Authorization","description":"Opaque installation credential using the exact value prefix Device. Returned on first local enrollment and an exact recoverable retry."},"localAuthorizationGrant":{"type":"oauth2","description":"Local Private Alpha substitute only. Not production OAuth 2.0 or OIDC.","flows":{"authorizationCode":{"authorizationUrl":"/app/developer","tokenUrl":"/api/developer/token","scopes":{"surveys:read":"Read surveys","webhooks:test":"Exercise loopback signed webhooks","mcp:invoke":"Invoke an authorized local MCP tool"}}}},"sessionCookie":{"type":"apiKey","in":"cookie","name":"listeniq_session"}},"parameters":{"SurveyId":{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Survey identifier"},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$"}},"MobileDeviceIdHeader":{"name":"x-listeniq-device-id","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Must exactly match the credential-bound installation identifier and the {id} path value."},"LibraryIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":12,"maxLength":120,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Scoped insertion reference. Exact replay is safe; changed payload reuse returns 409."},"ParticipantIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":12,"maxLength":120,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"When present, must exactly match idempotencyKey in the request body."},"DashboardShareIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":16,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Exact create replay returns the same derived URL. Changed payload reuse returns 409."},"ResponseImportIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Exact commit or rollback replay is safe. Reusing a key for a changed operation returns 409."},"OnboardingIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":16,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Scoped to one active workspace member. Exact replay returns the original first study; changed payload reuse returns 409."},"PublicAbuseIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Stored only as a keyed digest. Exact replay returns the original receipt or review result; changed reuse returns 409."},"AudienceCreditIdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":16,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Stored only as a SHA-256 digest. Exact replay returns the original synthetic-credit decision; changed reuse returns 409."}},"responses":{"Error":{"description":"Request failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication required or invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"RateLimited":{"description":"The bounded operation budget is exhausted","headers":{"Cache-Control":{"schema":{"const":"no-store"}},"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"PublicAbuseReportInput":{"type":"object","additionalProperties":false,"required":["surveySlug","category","narrative","idempotencyKey"],"properties":{"surveySlug":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{1,78}[a-z0-9])?$"},"category":{"enum":["deceptive_content","privacy_concern","unsafe_content","access_problem","other"]},"narrative":{"type":"string","minLength":10,"maxLength":1000},"idempotencyKey":{"type":"string","minLength":8,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$","writeOnly":true}}},"PublicAbuseReceiptResult":{"type":"object","additionalProperties":false,"required":["receipt","duplicate"],"properties":{"receipt":{"type":"object","additionalProperties":false,"required":["reference","status","disclosure"],"properties":{"reference":{"type":"string","pattern":"^[a-f0-9]{24}$"},"status":{"const":"received"},"disclosure":{"type":"string"}}},"duplicate":{"type":"boolean"}}},"PublicAbuseReport":{"type":"object","additionalProperties":false,"required":["id","surveyId","collectorId","category","narrative","status","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"collectorId":{"type":"string"},"category":{"enum":["deceptive_content","privacy_concern","unsafe_content","access_problem","other"]},"narrative":{"type":"string","maxLength":1000},"status":{"enum":["open","reviewed","actioned","dismissed"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"PublicAbuseTriageInput":{"type":"object","additionalProperties":false,"required":["reportId","status","action","note","idempotencyKey"],"properties":{"reportId":{"type":"string","minLength":8,"maxLength":200},"status":{"enum":["reviewed","actioned","dismissed"]},"action":{"enum":["none","pause_collector"]},"note":{"type":"string","minLength":3,"maxLength":500},"idempotencyKey":{"type":"string","minLength":8,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$","writeOnly":true}}},"PublicAbuseTriageResult":{"type":"object","additionalProperties":false,"required":["report","duplicate"],"properties":{"report":{"$ref":"#/components/schemas/PublicAbuseReport"},"duplicate":{"type":"boolean"}}},"DistributionWorkerSummary":{"type":"object","additionalProperties":false,"required":["runId","evaluatedAt","kitsScanned","phasesProcessed","deliveriesCreated","sandboxDelivered","suppressed","held","externalDelivery"],"properties":{"runId":{"type":"string","pattern":"^distribution-worker:[0-9]{4}-[0-9]{2}-[0-9]{2}$"},"evaluatedAt":{"type":"string","format":"date-time"},"kitsScanned":{"type":"integer","minimum":0,"maximum":1000},"phasesProcessed":{"type":"integer","minimum":0,"maximum":3000},"deliveriesCreated":{"type":"integer","minimum":0,"maximum":600000},"sandboxDelivered":{"type":"integer","minimum":0,"maximum":600000},"suppressed":{"type":"integer","minimum":0,"maximum":600000},"held":{"type":"integer","minimum":0,"maximum":600000},"externalDelivery":{"const":false}}},"Ok":{"type":"object","additionalProperties":false,"required":["ok"],"properties":{"ok":{"const":true}}},"Health":{"type":"object","additionalProperties":false,"required":["status","service","version","timestamp"],"properties":{"status":{"const":"ok"},"service":{"const":"listeniq-web"},"version":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}}},"Readiness":{"type":"object","additionalProperties":false,"required":["status","persistence","surveys","versions"],"properties":{"status":{"const":"ready"},"persistence":{"enum":["postgres","local-file"]},"surveys":{"type":"integer","minimum":0},"versions":{"type":"integer","minimum":0}}},"Error":{"type":"object","additionalProperties":false,"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}},"ErrorResponse":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"$ref":"#/components/schemas/Error"}}},"SessionCredentials":{"type":"object","additionalProperties":false,"required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","format":"password"}}},"CreateWorkspaceInvitation":{"type":"object","additionalProperties":false,"required":["email","role"],"properties":{"email":{"type":"string","format":"email"},"displayName":{"type":"string","minLength":2,"maxLength":100},"role":{"enum":["administrator","member","analyst","collector","viewer"]},"expiresInHours":{"type":"integer","minimum":1,"maximum":168,"default":72}}},"AcceptWorkspaceInvitation":{"type":"object","additionalProperties":false,"required":["displayName","password"],"properties":{"displayName":{"type":"string","minLength":2,"maxLength":100},"password":{"type":"string","format":"password","minLength":14,"maxLength":128,"writeOnly":true}}},"WorkspaceMember":{"type":"object","additionalProperties":false,"required":["id","workspaceId","email","displayName","role","status","joinedAt"],"properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"email":{"type":"string","format":"email"},"displayName":{"type":"string"},"role":{"enum":["owner","administrator","member","analyst","collector","viewer"]},"status":{"enum":["active","suspended"]},"joinedAt":{"type":"string","format":"date-time"},"invitedBy":{"type":"string"},"lastSignedInAt":{"type":"string","format":"date-time"}}},"WorkspaceInvitation":{"type":"object","additionalProperties":false,"required":["id","workspaceId","email","role","status","effectiveStatus","invitedBy","createdAt","expiresAt"],"properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"email":{"type":"string","format":"email"},"displayName":{"type":"string"},"role":{"enum":["administrator","member","analyst","collector","viewer"]},"status":{"enum":["pending","accepted","revoked","expired"]},"effectiveStatus":{"enum":["pending","accepted","revoked","expired"]},"invitedBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"acceptedAt":{"type":"string","format":"date-time"},"revokedAt":{"type":"string","format":"date-time"},"memberId":{"type":"string"}}},"RetentionPolicy":{"type":"object","additionalProperties":false,"required":["id","responseRetentionDays","reviewIntervalDays","enforcement","updatedAt","updatedBy"],"properties":{"id":{"const":"retention-workspace-demo"},"responseRetentionDays":{"enum":[365,730,1095]},"reviewIntervalDays":{"enum":[90,180,365]},"enforcement":{"const":"review_only"},"updatedAt":{"type":"string","format":"date-time"},"updatedBy":{"type":"string"}}},"RetentionPolicyChange":{"type":"object","additionalProperties":false,"required":["responseRetentionDays","reviewIntervalDays"],"properties":{"responseRetentionDays":{"enum":[365,730,1095]},"reviewIntervalDays":{"enum":[90,180,365]}}},"RegisteredMobileDevice":{"type":"object","additionalProperties":false,"required":["id","displayName","platform","appVersion","installationId","publicKeyThumbprint","registeredAt","lastSeenAt","status"],"properties":{"id":{"type":"string"},"displayName":{"type":"string"},"platform":{"enum":["iOS","Android"]},"appVersion":{"type":"string"},"installationId":{"type":"string"},"publicKeyThumbprint":{"type":"string"},"registeredAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"status":{"enum":["active","revoked"]},"policyRevision":{"type":"integer","minimum":1,"readOnly":true},"policyValidUntil":{"type":"string","format":"date-time","readOnly":true},"assignment":{"$ref":"#/components/schemas/FieldAssignmentBinding"},"revokedAt":{"type":"string","format":"date-time"},"revokedBy":{"type":"string"},"revocationReason":{"type":"string"}}},"DeviceRevocation":{"type":"object","additionalProperties":false,"required":["reason","confirmation"],"properties":{"reason":{"type":"string","minLength":10,"maxLength":240},"confirmation":{"type":"string","description":"Exact value REVOKE followed by the registered device identifier."}}},"FieldAssignmentBinding":{"type":"object","additionalProperties":false,"readOnly":true,"required":["surveyId","versionId","collectorId","versionChecksum","signingKeyId"],"properties":{"surveyId":{"type":"string"},"versionId":{"type":"string"},"collectorId":{"type":"string"},"versionChecksum":{"type":"string","pattern":"^[a-f0-9]{64}$"},"signingKeyId":{"type":"string"}}},"MobileFieldEnrollmentInput":{"type":"object","additionalProperties":false,"required":["surveyId","versionId","collectorId","displayName","platform","expiresInMinutes"],"properties":{"surveyId":{"type":"string"},"versionId":{"type":"string"},"collectorId":{"type":"string"},"displayName":{"type":"string","minLength":3,"maxLength":80},"platform":{"enum":["iOS","Android"]},"expiresInMinutes":{"type":"integer","minimum":5,"maximum":1440}}},"MobileFieldEnrollment":{"type":"object","additionalProperties":false,"required":["id","surveyId","versionId","collectorId","displayName","platform","createdAt","createdBy","expiresAt"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"versionId":{"type":"string"},"collectorId":{"type":"string"},"displayName":{"type":"string"},"platform":{"enum":["iOS","Android"]},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"usedAt":{"type":"string","format":"date-time"},"deviceId":{"type":"string"}}},"MobileFieldEnrollmentResult":{"type":"object","additionalProperties":false,"required":["enrollment","enrollmentToken"],"properties":{"enrollment":{"$ref":"#/components/schemas/MobileFieldEnrollment"},"enrollmentToken":{"type":"string","readOnly":true,"minLength":32,"maxLength":160,"description":"Response-only one-use secret. Clear it from the administrative screen immediately after controlled transfer."}}},"MobileDeviceEnrollmentRequest":{"type":"object","additionalProperties":false,"required":["enrollmentToken","installationId","appVersion","publicKeyThumbprint"],"properties":{"enrollmentToken":{"type":"string","writeOnly":true,"minLength":32,"maxLength":160},"installationId":{"type":"string","minLength":8,"maxLength":160},"appVersion":{"type":"string","minLength":3,"maxLength":80},"publicKeyThumbprint":{"type":"string","minLength":16,"maxLength":160}}},"MobileDevicePolicy":{"type":"object","additionalProperties":false,"required":["schemaVersion","deviceId","workspaceId","revision","state","issuedAt","validUntil","assignment"],"properties":{"schemaVersion":{"const":"1.0"},"deviceId":{"type":"string"},"workspaceId":{"type":"string"},"revision":{"type":"integer","minimum":1},"state":{"enum":["active","revoked"]},"issuedAt":{"type":"string","format":"date-time"},"validUntil":{"type":"string","format":"date-time"},"assignment":{"$ref":"#/components/schemas/FieldAssignmentBinding"},"revokedAt":{"type":"string","format":"date-time"},"revocationReason":{"type":"string"}}},"SignedMobileAssignmentPack":{"type":"object","additionalProperties":false,"required":["schemaVersion","policy","policySignatureBase64","signingKey","version"],"properties":{"schemaVersion":{"const":"1.0"},"policy":{"$ref":"#/components/schemas/MobileDevicePolicy"},"policySignatureBase64":{"type":"string"},"signingKey":{"type":"object","additionalProperties":false,"required":["id","publicKeyBase64"],"properties":{"id":{"type":"string"},"publicKeyBase64":{"type":"string"}}},"version":{"$ref":"#/components/schemas/PublishedVersion"}}},"MobileDeviceEnrollmentResult":{"type":"object","additionalProperties":false,"required":["device","credential","assignmentPack","duplicate"],"properties":{"device":{"$ref":"#/components/schemas/RegisteredMobileDevice"},"credential":{"type":"string","readOnly":true,"minLength":32,"maxLength":160,"description":"Response-only installation secret returned on first enrollment and exact recoverable retry."},"assignmentPack":{"$ref":"#/components/schemas/SignedMobileAssignmentPack"},"duplicate":{"type":"boolean","description":"True only for an exact recoverable retry of the original installation request."}}},"SurveyApprovalAction":{"type":"object","additionalProperties":false,"required":["action"],"properties":{"action":{"enum":["request","approve","changes_requested"]},"note":{"type":"string","maxLength":1000}}},"SurveyApprovalRequest":{"type":"object","additionalProperties":false,"required":["id","surveyId","revisionId","status","requestedBy","requestedAt"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"revisionId":{"type":"string"},"status":{"enum":["pending","approved","changes_requested","published"]},"requestedBy":{"type":"string","format":"email"},"requestedAt":{"type":"string","format":"date-time"},"decidedBy":{"type":"string","format":"email"},"decidedAt":{"type":"string","format":"date-time"},"decisionNote":{"type":"string"},"publishedVersionId":{"type":"string"}}},"SurveyReviewItemInput":{"type":"object","additionalProperties":false,"required":["kind","body"],"properties":{"kind":{"enum":["comment","suggestion"]},"body":{"type":"string","minLength":3,"maxLength":1500},"questionId":{"type":"string"}}},"SurveyReviewItem":{"type":"object","additionalProperties":false,"required":["id","surveyId","revisionId","kind","body","authorEmail","authorRole","status","createdAt"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"revisionId":{"type":"string"},"kind":{"enum":["comment","suggestion"]},"body":{"type":"string"},"questionId":{"type":"string"},"authorEmail":{"type":"string","format":"email"},"authorRole":{"enum":["owner","administrator","member","analyst","collector","viewer"]},"status":{"enum":["open","accepted","resolved"]},"createdAt":{"type":"string","format":"date-time"},"resolvedAt":{"type":"string","format":"date-time"},"resolvedBy":{"type":"string","format":"email"}}},"CreateStudyRequest":{"type":"object","additionalProperties":false,"required":["template","title","objective","decision","audience"],"properties":{"template":{"enum":["blank","experience","event"]},"title":{"type":"string","minLength":3,"maxLength":120},"objective":{"type":"string","minLength":10,"maxLength":500},"decision":{"type":"string","minLength":10,"maxLength":500},"audience":{"type":"string","minLength":3,"maxLength":300}}},"WorkspaceOnboardingInput":{"type":"object","additionalProperties":false,"required":["template","title","objective","decision","audience","privateAlphaAcknowledged"],"properties":{"template":{"enum":["blank","experience","event"]},"title":{"type":"string","minLength":3,"maxLength":120},"objective":{"type":"string","minLength":10,"maxLength":500},"decision":{"type":"string","minLength":10,"maxLength":500},"audience":{"type":"string","minLength":3,"maxLength":300},"privateAlphaAcknowledged":{"const":true}}},"WorkspaceOnboardingRecord":{"type":"object","additionalProperties":false,"required":["id","schemaVersion","workspaceId","memberId","memberEmail","role","template","surveyId","studyTitle","completedAt"],"properties":{"id":{"type":"string"},"schemaVersion":{"const":"listeniq.workspace-onboarding.v1"},"workspaceId":{"const":"workspace-demo"},"memberId":{"type":"string"},"memberEmail":{"type":"string","format":"email"},"role":{"enum":["owner","administrator","member"]},"template":{"enum":["blank","experience","event"]},"surveyId":{"type":"string","pattern":"^study-[0-9a-f-]{36}$"},"studyTitle":{"type":"string"},"completedAt":{"type":"string","format":"date-time"}}},"WorkspaceOnboardingResult":{"type":"object","additionalProperties":false,"required":["kind","record","surveyId","editorPath"],"properties":{"kind":{"enum":["created","replayed"]},"record":{"$ref":"#/components/schemas/WorkspaceOnboardingRecord"},"surveyId":{"type":"string"},"editorPath":{"type":"string","pattern":"^/app/studies/study-[0-9a-f-]{36}/edit$"}}},"QuestionLibraryAccessibility":{"type":"object","additionalProperties":false,"required":["plainLanguageReviewed","screenReaderSummary","keyboardEquivalent"],"properties":{"plainLanguageReviewed":{"type":"boolean"},"screenReaderSummary":{"type":"string","minLength":10,"maxLength":240},"keyboardEquivalent":{"type":"string","minLength":10,"maxLength":240}}},"QuestionLibraryInput":{"type":"object","additionalProperties":false,"required":["title","category","questionType","questionText","required","choices","rationale","accessibility"],"properties":{"title":{"type":"string","minLength":3,"maxLength":120},"category":{"type":"string","minLength":3,"maxLength":80},"questionType":{"enum":["single_choice","multiple_choice","short_text","long_text","rating","nps"]},"questionText":{"type":"string","minLength":5,"maxLength":240},"required":{"type":"boolean"},"choices":{"type":"array","maxItems":12,"items":{"type":"string","minLength":1,"maxLength":120}},"rationale":{"type":"string","minLength":10,"maxLength":500},"accessibility":{"$ref":"#/components/schemas/QuestionLibraryAccessibility"}}},"QuestionLibraryVersion":{"type":"object","additionalProperties":false,"required":["version","status","question","accessibility","rationale","createdAt","createdBy","contentDigest"],"properties":{"version":{"type":"integer","minimum":1},"status":{"enum":["proposed","approved"]},"question":{"$ref":"#/components/schemas/SurveyQuestion"},"accessibility":{"$ref":"#/components/schemas/QuestionLibraryAccessibility"},"rationale":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","format":"email"},"contentDigest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"approvedAt":{"type":"string","format":"date-time"},"approvedBy":{"type":"string","format":"email"}}},"QuestionLibraryAsset":{"type":"object","additionalProperties":false,"required":["id","workspaceId","title","category","ownerEmail","createdAt","versions"],"properties":{"id":{"type":"string","pattern":"^library-question-[0-9a-f-]{36}$"},"workspaceId":{"const":"workspace-demo"},"title":{"type":"string"},"category":{"type":"string"},"ownerEmail":{"type":"string","format":"email"},"createdAt":{"type":"string","format":"date-time"},"versions":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/QuestionLibraryVersion"}}}},"QuestionLibraryAuditEvent":{"type":"object","additionalProperties":false,"required":["id","actor","action","assetId","version","createdAt","details"],"properties":{"id":{"type":"string"},"actor":{"type":"string","format":"email"},"action":{"enum":["library.question_proposed","library.question_revision_proposed","library.question_approved"]},"assetId":{"type":"string"},"version":{"type":"integer","minimum":1},"createdAt":{"type":"string","format":"date-time"},"details":{"type":"object","additionalProperties":true}}},"QuestionLibraryState":{"type":"object","additionalProperties":false,"required":["schemaVersion","assets","audit"],"properties":{"schemaVersion":{"const":"listeniq.question-library.v1"},"assets":{"type":"array","items":{"$ref":"#/components/schemas/QuestionLibraryAsset"}},"audit":{"type":"array","items":{"$ref":"#/components/schemas/QuestionLibraryAuditEvent"}}}},"QuestionLibraryInsertInput":{"type":"object","additionalProperties":false,"required":["surveyId","pageId"],"properties":{"surveyId":{"type":"string","pattern":"^study-[0-9a-f-]{36}$"},"pageId":{"type":"string","pattern":"^page-[A-Za-z0-9-]{1,80}$"}}},"QuestionLibraryInsertResult":{"type":"object","additionalProperties":false,"required":["assetId","version","surveyId","question","duplicate"],"properties":{"assetId":{"type":"string"},"version":{"type":"integer","minimum":1},"surveyId":{"type":"string"},"question":{"$ref":"#/components/schemas/SurveyQuestion"},"duplicate":{"type":"boolean"}}},"DashboardShareCreateInput":{"type":"object","additionalProperties":false,"required":["label","password","segmentValue","expiresInHours"],"properties":{"label":{"type":"string","minLength":3,"maxLength":80},"password":{"type":"string","format":"password","minLength":12,"maxLength":128,"writeOnly":true},"segmentValue":{"type":"string","minLength":1,"maxLength":120},"expiresInHours":{"type":"integer","minimum":1,"maximum":168}}},"DashboardShare":{"type":"object","additionalProperties":false,"required":["id","surveyId","versionId","label","segmentQuestionId","segmentValue","status","createdBy","createdAt","expiresAt"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"versionId":{"type":"string"},"label":{"type":"string"},"segmentQuestionId":{"const":"driver"},"segmentValue":{"type":"string"},"status":{"enum":["active","revoked"]},"createdBy":{"type":"string","format":"email"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"revokedBy":{"type":"string","format":"email"},"revokedAt":{"type":"string","format":"date-time"}}},"ResponseImportInput":{"oneOf":[{"type":"object","additionalProperties":false,"required":["mode","versionId","versionChecksum","consentBasis","csv"],"properties":{"mode":{"const":"csv_import"},"versionId":{"type":"string","maxLength":120},"versionChecksum":{"type":"string","pattern":"^[0-9a-f]{64}$"},"consentBasis":{"type":"string","minLength":3,"maxLength":500},"csv":{"type":"string","maxLength":262144,"writeOnly":true}}},{"type":"object","additionalProperties":false,"required":["mode","versionId","versionChecksum","consentBasis","manualRow"],"properties":{"mode":{"const":"manual"},"versionId":{"type":"string","maxLength":120},"versionChecksum":{"type":"string","pattern":"^[0-9a-f]{64}$"},"consentBasis":{"type":"string","minLength":3,"maxLength":500},"manualRow":{"type":"object","maxProperties":100,"additionalProperties":{"type":"string","maxLength":10000},"writeOnly":true}}}]},"ResponseImportIssue":{"type":"object","additionalProperties":false,"required":["row","field","code","message"],"properties":{"row":{"type":"integer","minimum":0,"maximum":200},"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}},"ResponseImportBatch":{"type":"object","additionalProperties":false,"required":["id","schemaVersion","surveyId","versionId","versionChecksum","mode","status","operator","consentBasis","transformId","createdAt","rawBatchDigest","rowCount","responseIds"],"properties":{"id":{"type":"string"},"schemaVersion":{"const":"listeniq.response-imports.v1"},"surveyId":{"type":"string"},"versionId":{"type":"string"},"versionChecksum":{"type":"string","pattern":"^[0-9a-f]{64}$"},"mode":{"enum":["manual","csv_import"]},"status":{"enum":["committed","rolled_back"]},"operator":{"type":"string"},"consentBasis":{"type":"string"},"transformId":{"const":"listeniq.question-id-csv.v1"},"createdAt":{"type":"string","format":"date-time"},"rolledBackAt":{"type":"string","format":"date-time"},"rolledBackBy":{"type":"string"},"rawBatchDigest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"rowCount":{"type":"integer","minimum":1,"maximum":200},"responseIds":{"type":"array","maxItems":200,"items":{"type":"string"}}}},"ResponseImportPreview":{"type":"object","additionalProperties":false,"required":["surveyId","versionId","versionChecksum","mode","transformId","valid","rowCount","acceptedCount","rawBatchDigest","rows","issues","unsupportedTypes"],"properties":{"surveyId":{"type":"string"},"versionId":{"type":"string"},"versionChecksum":{"type":"string"},"mode":{"enum":["manual","csv_import"]},"transformId":{"const":"listeniq.question-id-csv.v1"},"valid":{"type":"boolean"},"rowCount":{"type":"integer","minimum":0,"maximum":200},"acceptedCount":{"type":"integer","minimum":0,"maximum":200},"rawBatchDigest":{"type":"string"},"rows":{"type":"array","maxItems":200,"items":{"type":"object","additionalProperties":false,"required":["rowNumber","externalReference","answerCount"],"properties":{"rowNumber":{"type":"integer"},"externalReference":{"type":"string"},"answerCount":{"type":"integer"},"outcome":{"enum":["complete","partial","disqualified","over_quota"]}}}},"issues":{"type":"array","items":{"$ref":"#/components/schemas/ResponseImportIssue"}},"unsupportedTypes":{"type":"array","items":{"enum":["ranking","matrix","allocation","repeating_group","signature_intent"]}}}},"ResponseImportRegister":{"type":"object","additionalProperties":false,"required":["version","batches"],"properties":{"version":{"type":"object","additionalProperties":false,"required":["id","checksum"],"properties":{"id":{"type":"string"},"checksum":{"type":"string"}}},"batches":{"type":"array","items":{"$ref":"#/components/schemas/ResponseImportBatch"}}}},"ResponseImportCommitResult":{"type":"object","additionalProperties":false,"required":["batch","responses","duplicate"],"properties":{"batch":{"$ref":"#/components/schemas/ResponseImportBatch"},"responses":{"type":"array","items":{"$ref":"#/components/schemas/ResponseRecord"}},"duplicate":{"type":"boolean"}}},"ResponseImportRollbackResult":{"type":"object","additionalProperties":false,"required":["batch","duplicate"],"properties":{"batch":{"$ref":"#/components/schemas/ResponseImportBatch"},"duplicate":{"type":"boolean"}}},"DashboardShareAuditEvent":{"type":"object","additionalProperties":false,"required":["id","shareId","action","actor","createdAt","details"],"properties":{"id":{"type":"string"},"shareId":{"type":"string"},"action":{"enum":["dashboard_share.created","dashboard_share.unlock_denied","dashboard_share.unlocked","dashboard_share.viewed","dashboard_share.revoked"]},"actor":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"details":{"type":"object","additionalProperties":true}}},"DashboardShareRegister":{"type":"object","additionalProperties":false,"required":["shares","audit"],"properties":{"shares":{"type":"array","items":{"$ref":"#/components/schemas/DashboardShare"}},"audit":{"type":"array","items":{"$ref":"#/components/schemas/DashboardShareAuditEvent"}}}},"DashboardShareCreateResult":{"type":"object","additionalProperties":false,"required":["share","url","duplicate"],"properties":{"share":{"$ref":"#/components/schemas/DashboardShare"},"url":{"type":"string","format":"uri","writeOnly":true},"duplicate":{"type":"boolean"}}},"CollectorPatch":{"type":"object","additionalProperties":false,"required":["name","status","anonymous"],"properties":{"name":{"type":"string","minLength":3,"maxLength":100},"status":{"enum":["active","paused","closed"]},"anonymous":{"type":"boolean"},"responseLimit":{"type":["integer","null"],"minimum":1,"maximum":10000000},"closesAt":{"type":["string","null"],"format":"date-time"}}},"Collector":{"allOf":[{"$ref":"#/components/schemas/CollectorPatch"},{"type":"object","required":["id","surveyId","type","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"type":{"const":"web_link"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}]},"SignedVersionSummary":{"type":"object","additionalProperties":false,"required":["id","signingKeyId","checksum"],"properties":{"id":{"type":"string"},"signingKeyId":{"type":"string"},"checksum":{"type":"string"}}},"DistributionContactInput":{"type":"object","additionalProperties":false,"required":["label","email","consent","optedOut"],"properties":{"label":{"type":"string","minLength":2,"maxLength":80},"email":{"type":"string","format":"email","writeOnly":true},"consent":{"type":"boolean"},"optedOut":{"type":"boolean"}}},"DistributionContactsInput":{"type":"object","additionalProperties":false,"required":["contacts"],"properties":{"contacts":{"type":"array","minItems":1,"maxItems":200,"items":{"$ref":"#/components/schemas/DistributionContactInput"}}}},"DistributionScheduleInput":{"type":"object","additionalProperties":false,"required":["invitationAt","reminderDelayHours","thankYouDelayHours"],"properties":{"invitationAt":{"type":"string","format":"date-time"},"reminderDelayHours":{"type":"integer","minimum":1,"maximum":720},"thankYouDelayHours":{"type":"integer","minimum":0,"maximum":720}}},"DistributionRunInput":{"type":"object","additionalProperties":false,"required":["phase"],"properties":{"phase":{"enum":["invitation","reminder","thank_you"]}}},"DistributionSchedule":{"type":"object","additionalProperties":false,"required":["invitationAt","reminderAt","thankYouDelayHours","createdAt","createdBy"],"properties":{"invitationAt":{"type":"string","format":"date-time"},"reminderAt":{"type":"string","format":"date-time"},"thankYouDelayHours":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"}}},"DistributionContactView":{"type":"object","additionalProperties":false,"required":["id","label","maskedEmail","consent","optedOut","completed","invitePath","openCount","deliveryStatuses"],"properties":{"id":{"type":"string"},"label":{"type":"string"},"maskedEmail":{"type":"string","description":"Masked display value. The raw address is not returned."},"consent":{"enum":["consented","pending"]},"optedOut":{"type":"boolean"},"completed":{"type":"boolean"},"invitePath":{"type":"string","description":"Authorized bearer path for the current signed survey version."},"openCount":{"type":"integer","minimum":0},"deliveryStatuses":{"type":"object","additionalProperties":false,"properties":{"invitation":{"enum":["sandbox_delivered","suppressed","held"]},"reminder":{"enum":["sandbox_delivered","suppressed","held"]},"thank_you":{"enum":["sandbox_delivered","suppressed","held"]}}}}},"DistributionAnalytics":{"type":"object","additionalProperties":false,"required":["contacts","consented","optedOut","opened","completed","sandboxDelivered","suppressed","held"],"properties":{"contacts":{"type":"integer","minimum":0},"consented":{"type":"integer","minimum":0},"optedOut":{"type":"integer","minimum":0},"opened":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"sandboxDelivered":{"type":"integer","minimum":0},"suppressed":{"type":"integer","minimum":0},"held":{"type":"integer","minimum":0}}},"DistributionView":{"type":"object","additionalProperties":false,"required":["id","surveyId","versionId","signingKeyId","contacts","analytics","externalDelivery","adapter"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"versionId":{"type":"string"},"signingKeyId":{"type":"string"},"schedule":{"$ref":"#/components/schemas/DistributionSchedule"},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/DistributionContactView"}},"analytics":{"$ref":"#/components/schemas/DistributionAnalytics"},"externalDelivery":{"const":false},"adapter":{"const":"deterministic_local_email"}}},"DistributionOperationResult":{"type":"object","additionalProperties":false,"required":["kind","duplicate","distribution"],"properties":{"kind":{"const":"ok"},"duplicate":{"type":"boolean"},"distribution":{"$ref":"#/components/schemas/DistributionView"}}},"Theme":{"type":"object","additionalProperties":false,"required":["accent","surface","radius"],"properties":{"accent":{"type":"string"},"surface":{"type":"string"},"radius":{"enum":["soft","crisp"]},"font":{"enum":["system","humanist","editorial"]},"density":{"enum":["comfortable","compact"]},"hideBranding":{"type":"boolean"}}},"QuestionOption":{"type":"object","additionalProperties":false,"required":["id","label"],"properties":{"id":{"type":"string"},"label":{"type":"string"}}},"RepeatingGroupField":{"type":"object","additionalProperties":false,"required":["id","label","type","required"],"properties":{"id":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"type":{"enum":["text","integer","boolean","date","choice"]},"required":{"type":"boolean"},"choices":{"type":"array","minItems":2,"maxItems":20,"items":{"$ref":"#/components/schemas/QuestionOption"}},"validation":{"$ref":"#/components/schemas/QuestionValidation"}}},"RepeatingGroupDefinition":{"type":"object","additionalProperties":false,"required":["definitionVersion","minRows","maxRows","fields"],"properties":{"definitionVersion":{"const":"1.0"},"minRows":{"type":"integer","minimum":0,"maximum":20},"maxRows":{"type":"integer","minimum":1,"maximum":20},"fields":{"type":"array","minItems":1,"maxItems":12,"items":{"$ref":"#/components/schemas/RepeatingGroupField"}}}},"RepeatingGroupAnswer":{"type":"object","additionalProperties":false,"required":["schemaVersion","rows"],"properties":{"schemaVersion":{"const":"1.0"},"rows":{"type":"array","maxItems":20,"items":{"type":"object","additionalProperties":false,"required":["rowId","values"],"properties":{"rowId":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$"},"values":{"type":"object","additionalProperties":{"oneOf":[{"type":"string","maxLength":10000},{"type":"integer"},{"type":"boolean"},{"type":"null"}]}}}}}}},"SurveySignatureIntent":{"type":"object","additionalProperties":false,"required":["definitionVersion","intentStatement","confirmationPhrase","consentNotice","jurisdiction","allowedCaptureMethods"],"properties":{"definitionVersion":{"const":"1.0"},"intentStatement":{"type":"string","minLength":10,"maxLength":500},"confirmationPhrase":{"const":"I CONFIRM"},"consentNotice":{"type":"object","additionalProperties":false,"required":["id","version","statement"],"properties":{"id":{"type":"string","maxLength":80},"version":{"type":"string","maxLength":40},"statement":{"type":"string","minLength":10,"maxLength":1000}}},"jurisdiction":{"type":"object","additionalProperties":false,"required":["code","warningId","warningVersion","warning"],"properties":{"code":{"const":"SG"},"warningId":{"type":"string","maxLength":80},"warningVersion":{"type":"string","maxLength":40},"warning":{"type":"string","minLength":10,"maxLength":1000}}},"allowedCaptureMethods":{"type":"array","minItems":2,"maxItems":2,"items":{"enum":["typed_confirmation","accessible_confirmation"]}}}},"SignatureIntentCaptureAnswer":{"type":"object","additionalProperties":false,"required":["schemaVersion","state","captureMethod","capturedAt","confirmationMatched","acknowledgements"],"properties":{"schemaVersion":{"const":"1.0"},"state":{"const":"capture"},"captureMethod":{"enum":["typed_confirmation","accessible_confirmation"]},"capturedAt":{"type":"string","format":"date-time"},"confirmationMatched":{"const":true},"acknowledgements":{"type":"object","additionalProperties":false,"required":["intent","consent","jurisdictionWarning"],"properties":{"intent":{"const":true},"consent":{"const":true},"jurisdictionWarning":{"const":true}}}}},"SignatureIntentReceiptAnswer":{"type":"object","additionalProperties":false,"readOnly":true,"required":["schemaVersion","state","decision","reason","captureMethod","capturedAt","captureArtifactDigest","outcomeDigest","intentStatementDigest","consentNoticeId","consentNoticeVersion","consentNoticeDigest","jurisdictionCode","jurisdictionWarningId","jurisdictionWarningVersion","jurisdictionWarningDigest","acknowledgements"],"properties":{"schemaVersion":{"const":"1.0"},"state":{"const":"receipt"},"decision":{"enum":["accept","review"]},"reason":{"enum":["ok","jurisdiction_review"]},"captureMethod":{"enum":["typed_confirmation","accessible_confirmation"]},"capturedAt":{"type":"string","format":"date-time"},"captureArtifactDigest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"outcomeDigest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"intentStatementDigest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"consentNoticeId":{"type":"string"},"consentNoticeVersion":{"type":"string"},"consentNoticeDigest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"jurisdictionCode":{"const":"SG"},"jurisdictionWarningId":{"type":"string"},"jurisdictionWarningVersion":{"type":"string"},"jurisdictionWarningDigest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"acknowledgements":{"type":"object","additionalProperties":false,"required":["intent","consent","jurisdictionWarning"],"properties":{"intent":{"const":true},"consent":{"const":true},"jurisdictionWarning":{"const":true}}}}},"SurveyQuizQuestion":{"type":"object","additionalProperties":false,"required":["definitionVersion","mode","maxPoints","partialCredit","feedback"],"properties":{"definitionVersion":{"const":"1.0"},"mode":{"enum":["single","multiple"]},"maxPoints":{"type":"integer","minimum":1,"maximum":10000},"partialCredit":{"enum":["none","proportional"]},"feedback":{"type":"object","additionalProperties":false,"required":["correct","partial","incorrect","unanswered"],"properties":{"correct":{"type":"string","minLength":1,"maxLength":500},"partial":{"type":"string","minLength":1,"maxLength":500},"incorrect":{"type":"string","minLength":1,"maxLength":500},"unanswered":{"type":"string","minLength":1,"maxLength":500}}}}},"SurveyQuizSettings":{"type":"object","additionalProperties":false,"required":["definitionVersion","passThresholdBasisPoints","feedbackRelease"],"properties":{"definitionVersion":{"const":"1.0"},"passThresholdBasisPoints":{"type":"integer","minimum":0,"maximum":10000},"feedbackRelease":{"const":"aggregate_only"}}},"SurveyQuizKeyBinding":{"type":"object","additionalProperties":false,"readOnly":true,"required":["definitionVersion","epoch","digest"],"properties":{"definitionVersion":{"const":"1.0"},"epoch":{"type":"integer","minimum":1},"digest":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"HMAC-derived protected key revision binding. This is not a raw answer-key hash."}}},"QuizKeyInput":{"type":"object","additionalProperties":false,"required":["surveyUpdatedAt","keys"],"properties":{"surveyUpdatedAt":{"type":"string","format":"date-time"},"keys":{"type":"array","maxItems":64,"items":{"type":"object","additionalProperties":false,"required":["questionId","correctOptionIds"],"properties":{"questionId":{"type":"string"},"correctOptionIds":{"type":"array","minItems":1,"maxItems":20,"uniqueItems":true,"writeOnly":true,"items":{"type":"string"}}}}}}},"QuizKeyEditorView":{"type":"object","additionalProperties":false,"required":["schemaVersion","surveyId","surveyUpdatedAt","revisionId","stale","keys","disclosure"],"properties":{"schemaVersion":{"const":"1.0"},"surveyId":{"type":"string"},"surveyUpdatedAt":{"type":"string","format":"date-time"},"revisionId":{"type":"string"},"stale":{"type":"boolean"},"keys":{"type":"array","maxItems":64,"items":{"type":"object","additionalProperties":false,"required":["questionId","correctOptionIds"],"properties":{"questionId":{"type":"string"},"correctOptionIds":{"type":"array","minItems":1,"maxItems":20,"uniqueItems":true,"items":{"type":"string"}}}}},"keyBinding":{"$ref":"#/components/schemas/SurveyQuizKeyBinding"},"disclosure":{"type":"string"}}},"QuizScoreReceipt":{"type":"object","additionalProperties":false,"readOnly":true,"required":["schemaVersion","policyVersion","earnedPoints","possiblePoints","percentageBasisPoints","passed","outcomeDigest","disclosure"],"properties":{"schemaVersion":{"const":"1.0"},"policyVersion":{"type":"string"},"earnedPoints":{"type":"integer","minimum":0},"possiblePoints":{"type":"integer","minimum":1},"percentageBasisPoints":{"type":"integer","minimum":0,"maximum":10000},"passed":{"type":"boolean"},"outcomeDigest":{"type":"string","pattern":"^[0-9a-f]{64}$","description":"HMAC-protected public aggregate receipt digest, not the private core item-result digest."},"disclosure":{"type":"string"}}},"SurveyQuestion":{"type":"object","additionalProperties":false,"required":["id","type","title","required"],"properties":{"id":{"type":"string"},"type":{"enum":["single_choice","multiple_choice","dropdown","short_text","long_text","number","email","date","rating","nps","consent","ranking","matrix","slider","phone","time","allocation","quiz_choice","repeating_group","signature_intent"]},"title":{"type":"string"},"description":{"type":"string"},"required":{"type":"boolean"},"choices":{"type":"array","items":{"type":"string"}},"items":{"type":"array","items":{"$ref":"#/components/schemas/QuestionOption"}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/QuestionOption"}},"columns":{"type":"array","items":{"$ref":"#/components/schemas/QuestionOption"}},"min":{"type":"number"},"max":{"type":"number"},"step":{"type":"number","exclusiveMinimum":0},"allocationTotal":{"type":"integer","minimum":1,"maximum":10000},"allocationStep":{"type":"integer","minimum":1,"maximum":10000},"quiz":{"$ref":"#/components/schemas/SurveyQuizQuestion"},"repeatingGroup":{"$ref":"#/components/schemas/RepeatingGroupDefinition"},"signatureIntent":{"$ref":"#/components/schemas/SurveySignatureIntent"},"lowLabel":{"type":"string"},"highLabel":{"type":"string"},"pageId":{"type":"string"},"validation":{"$ref":"#/components/schemas/QuestionValidation"}}},"QuestionValidation":{"type":"object","additionalProperties":false,"properties":{"minLength":{"type":"integer","minimum":0,"maximum":10000},"maxLength":{"type":"integer","minimum":0,"maximum":10000},"minValue":{"type":"number"},"maxValue":{"type":"number"},"pattern":{"type":"string","maxLength":256},"customMessage":{"type":"string"}}},"SurveyPage":{"type":"object","additionalProperties":false,"required":["id","title","questionIds"],"properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"questionIds":{"type":"array","items":{"type":"string"}}}},"SurveyResearchPlan":{"type":"object","additionalProperties":false,"required":["brief","title","rationale","sampleGuidance","risks","analysisPlan","generatedBy","generatedAt"],"properties":{"brief":{"$ref":"#/components/schemas/ResearchBrief"},"title":{"type":"string"},"rationale":{"type":"string"},"sampleGuidance":{"type":"string"},"risks":{"type":"array","items":{"type":"string"}},"analysisPlan":{"type":"array","items":{"type":"string"}},"generatedBy":{"enum":["deterministic_fallback","ai_provider"]},"generatedAt":{"type":"string","format":"date-time"}}},"SurveyPresentation":{"type":"object","additionalProperties":false,"required":["mode"],"properties":{"mode":{"enum":["classic","one_question"]}}},"LogicRule":{"type":"object","additionalProperties":false,"required":["id","questionId","operator","value","action"],"properties":{"id":{"type":"string"},"questionId":{"type":"string"},"operator":{"enum":["equals","not_equals","less_than","greater_than","contains","is_empty","is_not_empty"]},"value":{"oneOf":[{"type":"string"},{"type":"number"}]},"action":{"enum":["show","hide","skip_to","disqualify"]},"targetQuestionId":{"type":"string"}}},"SurveyDraft":{"type":"object","additionalProperties":false,"required":["id","workspaceId","slug","title","objective","decision","audience","status","language","languages","questions","logic","theme","updatedAt"],"properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"objective":{"type":"string"},"decision":{"type":"string"},"audience":{"type":"string"},"status":{"enum":["draft","published","archived"]},"language":{"type":"string"},"languages":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"$ref":"#/components/schemas/SurveyQuestion"}},"pages":{"type":"array","items":{"$ref":"#/components/schemas/SurveyPage"}},"logic":{"type":"array","items":{"$ref":"#/components/schemas/LogicRule"}},"quotas":{"type":"array","items":{"type":"object"}},"translations":{"type":"object","additionalProperties":{"type":"object"}},"researchPlan":{"$ref":"#/components/schemas/SurveyResearchPlan"},"presentation":{"$ref":"#/components/schemas/SurveyPresentation"},"quizSettings":{"$ref":"#/components/schemas/SurveyQuizSettings"},"quizKeyBinding":{"$ref":"#/components/schemas/SurveyQuizKeyBinding"},"theme":{"$ref":"#/components/schemas/Theme"},"completion":{"type":"object","required":["title","message"],"properties":{"title":{"type":"string"},"message":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}}},"updatedAt":{"type":"string","format":"date-time"},"publishedVersionId":{"type":"string"}}},"PublishedVersion":{"type":"object","additionalProperties":false,"required":["id","surveyId","version","checksum","signature","signingKeyId","schemaVersion","compilerVersion","publishedAt","definition"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"version":{"type":"integer","minimum":1},"checksum":{"type":"string"},"signature":{"type":"string"},"signingKeyId":{"type":"string"},"schemaVersion":{"enum":["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7"]},"compilerVersion":{"type":"string"},"publishedAt":{"type":"string","format":"date-time"},"definition":{"$ref":"#/components/schemas/SurveyDraft"}}},"SurveyResource":{"type":"object","required":["data","included"],"properties":{"data":{"$ref":"#/components/schemas/SurveyDraft"},"included":{"type":"object","properties":{"publishedVersion":{"$ref":"#/components/schemas/PublishedVersion"}}}}},"AnswerValue":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"}]}},{"$ref":"#/components/schemas/RepeatingGroupAnswer"},{"$ref":"#/components/schemas/SignatureIntentCaptureAnswer"},{"$ref":"#/components/schemas/SignatureIntentReceiptAnswer"}]},"ResponseSubmission":{"type":"object","additionalProperties":false,"required":["surveyId","versionId","answers","startedAt"],"properties":{"idempotencyKey":{"type":"string","minLength":8,"maxLength":160,"pattern":"^[A-Za-z0-9._:-]+$"},"surveyId":{"type":"string"},"versionId":{"type":"string"},"collectorId":{"type":"string"},"answers":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/AnswerValue"}},"startedAt":{"type":"string","format":"date-time"},"language":{"type":"string"},"source":{"enum":["web","offline","kiosk","api"]},"participantAssignmentToken":{"type":"string","minLength":32,"maxLength":160,"writeOnly":true},"distributionInviteToken":{"type":"string","minLength":32,"maxLength":800,"writeOnly":true}}},"QualityFlag":{"type":"object","required":["code","severity","explanation"],"properties":{"code":{"enum":["speeding","straight_lining","duplicate","low_information"]},"severity":{"enum":["info","review"]},"explanation":{"type":"string"}}},"ResponseRecord":{"type":"object","required":["id","idempotencyKey","surveyId","versionId","collectorId","status","answers","startedAt","submittedAt","language","source","qualityFlags"],"properties":{"id":{"type":"string"},"idempotencyKey":{"type":"string"},"surveyId":{"type":"string"},"versionId":{"type":"string"},"collectorId":{"type":"string"},"status":{"enum":["complete","partial","disqualified","over_quota"]},"answers":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/AnswerValue"}},"startedAt":{"type":"string","format":"date-time"},"submittedAt":{"type":"string","format":"date-time"},"language":{"type":"string"},"source":{"enum":["web","offline","kiosk","api","manual","import"]},"qualityFlags":{"type":"array","items":{"$ref":"#/components/schemas/QualityFlag"}},"participantAssignmentId":{"type":"string","readOnly":true},"quizScore":{"$ref":"#/components/schemas/QuizScoreReceipt"}}},"ResponseSubmissionResult":{"type":"object","required":["response","duplicate"],"properties":{"response":{"$ref":"#/components/schemas/ResponseRecord"},"duplicate":{"type":"boolean"}}},"ResponseReviewPatch":{"type":"object","additionalProperties":false,"required":["disposition"],"properties":{"disposition":{"enum":["included","excluded"]},"reasonCode":{"enum":["duplicate","speeding","ineligible","test","other"]},"note":{"type":"string","maxLength":1000},"annotation":{"type":"string","maxLength":2000}},"allOf":[{"if":{"properties":{"disposition":{"const":"excluded"}}},"then":{"required":["reasonCode"]}}]},"ResponseReview":{"type":"object","additionalProperties":false,"required":["id","responseId","surveyId","disposition","actor","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"responseId":{"type":"string"},"surveyId":{"type":"string"},"disposition":{"enum":["included","excluded"]},"reasonCode":{"enum":["duplicate","speeding","ineligible","test","other"]},"note":{"type":"string","maxLength":1000},"annotation":{"type":"string","maxLength":2000},"actor":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"allOf":[{"if":{"properties":{"disposition":{"const":"excluded"}}},"then":{"required":["reasonCode"]}}]},"AnalysisQueryInput":{"type":"object","additionalProperties":false,"required":["question"],"properties":{"question":{"type":"string","minLength":8,"maxLength":500},"driver":{"type":"string","maxLength":120}}},"AnalysisEvidence":{"type":"object","additionalProperties":false,"required":["questionId","responseIds","filters","sampleSize","method","uncertainty"],"properties":{"questionId":{"type":"string"},"responseIds":{"type":"array","items":{"type":"string"}},"filters":{"type":"string"},"sampleSize":{"type":"integer","minimum":0},"method":{"type":"string"},"uncertainty":{"type":"string"},"confidenceInterval":{"type":"object","additionalProperties":false,"required":["level","lower","upper"],"properties":{"level":{"const":0.95},"lower":{"type":"number"},"upper":{"type":"number"}}}}},"AnalysisAnswer":{"type":"object","additionalProperties":false,"required":["statement","label","generator","evidence"],"properties":{"statement":{"type":"string"},"label":{"enum":["Statistical result","Deterministic coding assist"]},"generator":{"const":"deterministic_evidence_fallback"},"evidence":{"$ref":"#/components/schemas/AnalysisEvidence"}}},"AnalysisQueryRecord":{"type":"object","additionalProperties":false,"required":["id","surveyId","question","generator","answer","responseIds","createdAt","actor"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"question":{"type":"string"},"driver":{"type":"string"},"generator":{"const":"deterministic_evidence_fallback"},"answer":{"type":"string"},"responseIds":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"actor":{"type":"string"}}},"AnalysisQueryResult":{"type":"object","additionalProperties":false,"required":["record","answer"],"properties":{"record":{"$ref":"#/components/schemas/AnalysisQueryRecord"},"answer":{"$ref":"#/components/schemas/AnalysisAnswer"}}},"ResearchBrief":{"type":"object","additionalProperties":false,"required":["objective","decision","population","constraints","language"],"properties":{"objective":{"type":"string"},"decision":{"type":"string"},"population":{"type":"string"},"constraints":{"type":"string"},"language":{"type":"string"}}},"ResearchPlan":{"type":"object","required":["title","rationale","sampleGuidance","risks","analysisPlan","questions"],"properties":{"title":{"type":"string"},"rationale":{"type":"string"},"sampleGuidance":{"type":"string"},"risks":{"type":"array","items":{"type":"string"}},"analysisPlan":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"$ref":"#/components/schemas/SurveyQuestion"}}}},"WorkflowRun":{"type":"object","required":["id","workflowId","responseId","status","trigger","proposedAction","owner","dueAt","createdAt"],"properties":{"id":{"type":"string"},"workflowId":{"type":"string"},"responseId":{"type":"string"},"status":{"enum":["awaiting_approval","approved","completed","rejected"]},"trigger":{"type":"string"},"proposedAction":{"type":"string"},"owner":{"type":"string"},"dueAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}},"WorkflowCase":{"type":"object","additionalProperties":false,"required":["id","runId","workflowId","surveyId","responseId","title","status","owner","slaDueAt","adapter","createdAt","createdBy"],"properties":{"id":{"type":"string"},"runId":{"type":"string"},"workflowId":{"type":"string"},"surveyId":{"type":"string"},"responseId":{"type":"string"},"title":{"type":"string"},"status":{"enum":["open","resolved"]},"owner":{"type":"string"},"slaDueAt":{"type":"string","format":"date-time"},"adapter":{"const":"sandbox_case"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"resolvedAt":{"type":"string","format":"date-time"},"resolvedBy":{"type":"string"},"outcome":{"type":"string"},"effect":{"type":"string"}}},"WorkflowOutcomeInput":{"type":"object","additionalProperties":false,"required":["outcome"],"properties":{"outcome":{"type":"string","minLength":10,"maxLength":1000},"effect":{"type":"string","maxLength":1000}}},"WorkflowActionResult":{"type":"object","additionalProperties":false,"required":["run","case","duplicate"],"properties":{"run":{"$ref":"#/components/schemas/WorkflowRun"},"case":{"$ref":"#/components/schemas/WorkflowCase"},"duplicate":{"type":"boolean"}}},"CreateAudienceOrder":{"type":"object","additionalProperties":false,"required":["surveyId","title","targetInterest","requestedCompletions","expectedDurationMinutes","rewardPoints"],"properties":{"surveyId":{"type":"string"},"title":{"type":"string","minLength":3,"maxLength":120},"targetInterest":{"type":"string","minLength":2,"maxLength":80},"requestedCompletions":{"type":"integer","minimum":1,"maximum":10000},"expectedDurationMinutes":{"type":"integer","minimum":1,"maximum":120},"rewardPoints":{"type":"integer","minimum":1,"maximum":10000}}},"AudienceOrder":{"type":"object","additionalProperties":false,"description":"Privacy-minimized researcher order view with credential and actor fields omitted.","required":["id","surveyId","title","status","targetInterest","requestedCompletions","expectedDurationMinutes","rewardPoints","eligibleCount","completedCount","createdAt"],"properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"title":{"type":"string"},"status":{"enum":["draft","fielding","completed","cancelled"]},"targetInterest":{"type":"string"},"requestedCompletions":{"type":"integer"},"expectedDurationMinutes":{"type":"integer"},"rewardPoints":{"type":"integer"},"eligibleCount":{"type":"integer"},"completedCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"approvedAt":{"type":"string","format":"date-time"}}},"ParticipantAssignment":{"type":"object","additionalProperties":false,"required":["id","orderId","participantId","surveyId","status","expectedDurationMinutes","rewardPoints","dataUse","sandboxAccessToken","assignedAt"],"properties":{"id":{"type":"string"},"orderId":{"type":"string"},"participantId":{"type":"string"},"surveyId":{"type":"string"},"status":{"enum":["invited","completed","expired"]},"expectedDurationMinutes":{"type":"integer"},"rewardPoints":{"type":"integer"},"dataUse":{"type":"string"},"sandboxAccessToken":{"type":"string","writeOnly":true},"assignedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"responseId":{"type":"string"},"rewardEntryId":{"type":"string"}}},"AudienceCreditEstimate":{"type":"object","additionalProperties":false,"required":["orderId","formulaVersion","requestedCompletions","eligibleCompletions","creditsPerCompletion","estimatedCredits","orderDigest","createdAt"],"properties":{"orderId":{"type":"string"},"formulaVersion":{"const":"listeniq.synthetic-audience-credit.v1"},"requestedCompletions":{"type":"integer","minimum":1,"maximum":10000},"eligibleCompletions":{"type":"integer","minimum":0,"maximum":10000},"creditsPerCompletion":{"type":"integer","minimum":0,"maximum":1000000000},"estimatedCredits":{"type":"integer","minimum":0,"maximum":1000000000},"orderDigest":{"type":"string","pattern":"^[a-f0-9]{64}$"},"createdAt":{"type":"string","format":"date-time"}}},"AudienceCreditLedgerEntry":{"type":"object","additionalProperties":false,"required":["id","kind","credits","actorRole","createdAt"],"properties":{"id":{"type":"string"},"kind":{"enum":["allocation_changed","reservation","release"]},"credits":{"type":"integer","minimum":-1000000000,"maximum":1000000000},"orderId":{"type":"string"},"reference":{"type":"string"},"actorRole":{"enum":["owner","administrator","member"]},"createdAt":{"type":"string","format":"date-time"}}},"AudienceBudgetView":{"type":"object","additionalProperties":false,"required":["schemaVersion","unit","allocation","reserved","available","estimates","ledger","disclosure"],"properties":{"schemaVersion":{"const":"1.0"},"unit":{"const":"synthetic_internal_research_credit"},"allocation":{"type":"integer","minimum":0,"maximum":1000000000},"reserved":{"type":"integer","minimum":0,"maximum":1000000000},"available":{"type":"integer","minimum":0,"maximum":1000000000},"estimates":{"type":"array","maxItems":5000,"items":{"$ref":"#/components/schemas/AudienceCreditEstimate"}},"ledger":{"type":"array","maxItems":10000,"items":{"$ref":"#/components/schemas/AudienceCreditLedgerEntry"}},"disclosure":{"type":"string"}}},"AudienceAllocationInput":{"type":"object","additionalProperties":false,"required":["allocation"],"properties":{"allocation":{"type":"integer","minimum":0,"maximum":1000000000}}},"AudienceAllocationResult":{"type":"object","additionalProperties":false,"required":["budget","receipt","duplicate"],"properties":{"budget":{"$ref":"#/components/schemas/AudienceBudgetView"},"receipt":{"type":"string"},"duplicate":{"type":"boolean"}}},"AudienceAssignmentSummary":{"type":"object","additionalProperties":false,"required":["orderId","total","invited","completed","expired"],"properties":{"orderId":{"type":"string"},"total":{"type":"integer","minimum":0,"maximum":10000},"invited":{"type":"integer","minimum":0,"maximum":10000},"completed":{"type":"integer","minimum":0,"maximum":10000},"expired":{"type":"integer","minimum":0,"maximum":10000}}},"AudienceOrderCreationResult":{"type":"object","additionalProperties":false,"required":["order","estimate","budget","duplicate"],"properties":{"order":{"$ref":"#/components/schemas/AudienceOrder"},"estimate":{"$ref":"#/components/schemas/AudienceCreditEstimate"},"budget":{"$ref":"#/components/schemas/AudienceBudgetView"},"duplicate":{"type":"boolean"}}},"AudienceApprovalResult":{"type":"object","additionalProperties":false,"required":["order","assignmentSummary","budget","receipt","duplicate"],"properties":{"order":{"$ref":"#/components/schemas/AudienceOrder"},"assignmentSummary":{"$ref":"#/components/schemas/AudienceAssignmentSummary"},"budget":{"$ref":"#/components/schemas/AudienceBudgetView"},"receipt":{"type":"string"},"duplicate":{"type":"boolean"}}},"AudienceCancellationResult":{"type":"object","additionalProperties":false,"required":["order","assignmentSummary","budget","receipt","duplicate"],"properties":{"order":{"$ref":"#/components/schemas/AudienceOrder"},"assignmentSummary":{"$ref":"#/components/schemas/AudienceAssignmentSummary"},"budget":{"$ref":"#/components/schemas/AudienceBudgetView"},"receipt":{"type":"string"},"duplicate":{"type":"boolean"}}},"SandboxRedemption":{"type":"object","additionalProperties":false,"required":["points","provider","idempotencyKey"],"properties":{"points":{"const":100},"provider":{"const":"sandbox-voucher"},"idempotencyKey":{"type":"string","minLength":16,"maxLength":160}}},"Participant":{"type":"object","required":["id","displayName","status","interests","points","consentedAt"],"properties":{"id":{"type":"string"},"displayName":{"type":"string"},"status":{"enum":["active","withdrawn","review"]},"interests":{"type":"array","items":{"type":"string"}},"points":{"type":"integer"},"consentedAt":{"type":"string","format":"date-time"},"consentVersion":{"type":"string"},"jurisdiction":{"type":"string"},"ageBand":{"enum":["18-24","25-34","35-44","45-54","55+"]},"verifiedAt":{"type":"string","format":"date-time"}}},"RewardEntry":{"type":"object","required":["id","participantId","points","kind","status","description","createdAt"],"properties":{"id":{"type":"string"},"participantId":{"type":"string"},"points":{"type":"integer"},"kind":{"enum":["survey_completion","sandbox_redemption","adjustment"]},"status":{"enum":["posted","pending","reversed"]},"description":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"idempotencyKey":{"type":"string"},"referenceId":{"type":"string"},"provider":{"enum":["sandbox-voucher","sandbox-ledger"]}}},"ParticipantExportInput":{"type":"object","additionalProperties":false,"required":["idempotencyKey"],"properties":{"idempotencyKey":{"type":"string","minLength":12,"maxLength":120,"pattern":"^[A-Za-z0-9._:-]+$"}}},"ParticipantWithdrawalInput":{"type":"object","additionalProperties":false,"required":["idempotencyKey","confirmation"],"properties":{"idempotencyKey":{"type":"string","minLength":12,"maxLength":120,"pattern":"^[A-Za-z0-9._:-]+$"},"confirmation":{"const":"WITHDRAW FUTURE MATCHING"},"reason":{"type":"string","maxLength":240}}},"ParticipantSupportInput":{"type":"object","additionalProperties":false,"required":["idempotencyKey","kind","subject","message"],"properties":{"idempotencyKey":{"type":"string","minLength":12,"maxLength":120,"pattern":"^[A-Za-z0-9._:-]+$"},"kind":{"enum":["general_support","reward_dispute"]},"subject":{"type":"string","minLength":5,"maxLength":120},"message":{"type":"string","minLength":10,"maxLength":1000},"rewardEntryId":{"type":"string"}},"allOf":[{"if":{"properties":{"kind":{"const":"reward_dispute"}}},"then":{"required":["rewardEntryId"]}}]},"ParticipantSupportCase":{"type":"object","additionalProperties":false,"required":["id","participantId","kind","subject","message","status","adapter","createdAt","idempotencyKey"],"properties":{"id":{"type":"string"},"participantId":{"type":"string"},"kind":{"enum":["general_support","reward_dispute"]},"subject":{"type":"string"},"message":{"type":"string"},"status":{"const":"open"},"adapter":{"const":"sandbox_support"},"createdAt":{"type":"string","format":"date-time"},"idempotencyKey":{"type":"string"},"rewardEntryId":{"type":"string"}}},"ParticipantActivityExport":{"type":"object","additionalProperties":false,"required":["schemaVersion","generatedAt","source","participant","activity","disclosure"],"properties":{"schemaVersion":{"const":"listeniq.participant-export.v1"},"generatedAt":{"type":"string","format":"date-time"},"source":{"const":"local_private_alpha"},"participant":{"$ref":"#/components/schemas/Participant"},"activity":{"type":"object","additionalProperties":false,"required":["assignments","responses","rewards","supportCases","audit"],"properties":{"assignments":{"type":"array","items":{"type":"object","description":"Participant assignment without the sandbox access token."}},"responses":{"type":"array","items":{"$ref":"#/components/schemas/ResponseRecord"}},"rewards":{"type":"array","items":{"$ref":"#/components/schemas/RewardEntry"}},"supportCases":{"type":"array","items":{"$ref":"#/components/schemas/ParticipantSupportCase"}},"audit":{"type":"array","items":{"type":"object","required":["id","action","target","createdAt","details"],"properties":{"id":{"type":"string"},"action":{"type":"string"},"target":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"details":{"type":"object","additionalProperties":true}}}}}},"disclosure":{"type":"string"}}},"ParticipantWithdrawalEffect":{"type":"object","additionalProperties":false,"required":["expiredAssignments","responseCountPreserved","rewardEntriesPreserved","pointsBefore","pointsAfter","rewardHistoryUnchanged","matchingStatus","researchRecordsDeleted"],"properties":{"expiredAssignments":{"type":"integer","minimum":0},"responseCountPreserved":{"type":"integer","minimum":0},"rewardEntriesPreserved":{"type":"integer","minimum":0},"pointsBefore":{"type":"integer"},"pointsAfter":{"type":"integer"},"rewardHistoryUnchanged":{"type":"boolean"},"matchingStatus":{"const":"withdrawn"},"researchRecordsDeleted":{"const":0}}},"ParticipantWithdrawalResult":{"type":"object","additionalProperties":false,"required":["participant","effect","duplicate"],"properties":{"participant":{"$ref":"#/components/schemas/Participant"},"effect":{"$ref":"#/components/schemas/ParticipantWithdrawalEffect"},"duplicate":{"type":"boolean"}}},"ParticipantSupportResult":{"type":"object","additionalProperties":false,"required":["supportCase","duplicate"],"properties":{"supportCase":{"$ref":"#/components/schemas/ParticipantSupportCase"},"duplicate":{"type":"boolean"}}},"RedemptionResult":{"type":"object","required":["participant","entry","duplicate"],"properties":{"participant":{"$ref":"#/components/schemas/Participant"},"entry":{"$ref":"#/components/schemas/RewardEntry"},"duplicate":{"type":"boolean"}}}}}}