Infer and prefill
complianceQuestionnaireInfer resolves the applicable programs for your items,
opens a session, and pre-answers questions from your item data. Each
pre-filled answer has provenance: INFERRED and a confidence score.
Pass intendedUse to guide inference — storefront flows should send CONSUMER.
mutation InferQuestionnaire($input: ComplianceQuestionnaireInferInput!) { complianceQuestionnaireInfer(input: $input) { session { id status lines { id programId status currentQuestion { code prompt answerType } } } lines { lineId state remainingRequiredCount } }}Each line's state tells you what's next:
READY_TO_ATTEST- every required question is answered. Go straight to Attest (below).PARTIAL- some answers were pre-filled, but required questions remain. Answer them atcurrentQuestion.NOT_INFERRED- nothing could be pre-filled; answer it as a plain questionnaire.
Programs already satisfied by an existing response are skipped and returned in
alreadySatisfied (omitted above).
Review and correct
The session holds pre-filled answers — not a finalized response. For each answer, the shipper either:
- accepts it — leaves it untouched, and it stays
INFERRED, or - corrects it — submits a new value with
questionnaireAnswersSubmit, which becomesMANUAL.
Submit one answer or several at once. Clarify advances currentQuestion to the
next remaining question and, when none are left, finalizes the line's
response (its responseId is populated).
For example, the shipper accepts the inferred intended_use but corrects
contains_color_additives, so they submit just that one answer:
mutation SubmitAnswers($input: QuestionnaireAnswersSubmitInput!) { questionnaireAnswersSubmit(input: $input) { status lines { id status responseId answers { questionCode value provenance confidence } } }}Attest
When a line is READY_TO_ATTEST — every required answer already pre-filled and
the shipper agrees — accept it in one call with questionnaireSessionAttest. It
finalizes every eligible line, or only the lineIds you pass.
mutation AttestSession($input: QuestionnaireSessionAttestInput!) { questionnaireSessionAttest(input: $input) { id status lines { id status responseId } }}To discard an in-progress session, call questionnaireSessionAbandon(id: ID!).
Submit a complete response
If you already have every answer — for example a reusable answer set for a
CATALOG_ITEM — skip the session and submit directly with
questionnaireResponseSubmit. It replaces any previous response for the same
item and program.
mutation SubmitResponse($input: QuestionnaireResponseSubmitInput!) { questionnaireResponseSubmit(input: $input) { id status completedAt answers { questionCode value provenance } }}Prefer to answer without inference? questionnaireSessionStart opens a session
for the programs you choose, and then you use the same Review and correct and
Attest calls above.
Read responses and readiness
Fetch a finalized record with questionnaireResponse(id), and check whether a
whole container is ready to file with containerComplianceReadiness —
ready is true only when every line has a complete response.
query ContainerReadiness($containerType: ContainerType!, $containerId: ID!) { containerComplianceReadiness( containerType: $containerType containerId: $containerId ) { ready totalLineCount outstandingLineCount }}Next steps
- How it works - branching, provenance, dynamic options, and intended use.
- Check compliance requirements - discover programs and read questionnaire structures.
Complete a questionnaire
Clarify pre-fills what it can from your item data; you confirm or correct the rest, then finalize.
GraphQL
Once you know which programs apply (see Check compliance requirements), the recommended flow is three calls:
complianceQuestionnaireInferopens a session with answers pre-filled from your item data.questionnaireAnswersSubmitto change anything the shipper disagrees with and answer what's left.questionnaireSessionAttestto accept and finalize.If you already have every answer, you can submit a complete response in one call instead — see Submit a complete response below.
Reading requires the
COMPLIANCE_READscope; submitting answers requiresCOMPLIANCE_WRITE. See OAuth.Every answer
valueis a JSON-encoded string: a boolean is"true", a select or text value is quoted like"\"cosmetic\"", a multi-select is"[\"a\",\"b\"]", and a number is"42".