# Questions and Answers

## Overview

The **Questions and Answers (Q&A)** feature provides an easy way to retrieve compliance questions from Solaris (e.g., for [Customer Due Diligence](/guides/kyc/cdd)), collect answers from the customer in your solution, and pass the answers back to Solaris.

For the Customer Due Diligence use case, Solaris generally creates question sets if a customer ends up with a "yellow" status during screening.

This guide explains the flow behind the Q&A API and how to implement it in your solution.

## Partner flow: Q&A

![Diagram: Q&A API partner flow](/assets/questions-and-answers-flow.abf73b0d34a355e8e340f001c06ba37206b795e527cee67939358f0ee3c849cf.71dde5d8.svg)

The Q&A process works as follows:

1. Solaris creates a set of due diligence questions for one of your customers based on an internal event (e.g., findings as part of the [Customer Due Diligence](/guides/kyc/cdd) process). These are stored as an array of `question` resources within a single `question_set` resource.
2. Solaris sends a notification on the `QUESTIONS_REQUIRE_RESPONSE` webhook event. The payload contains the following:
  * The **recipient** of the question set. This can be one of the following:
    * `CUSTOMER`: You must prompt your customer in your frontend to answer the questions by the deadline.
    * `PARTNER`: Your support department must answer the questions. In this case, **do not show the questions to the customer.**
  * The set of questions to be answered.
  * The **deadline** by which the recipient must answer the questions.
3. Derive the questions from the webhook payload (or by calling [GET Retrieve questions in a question set](/api-reference/onboarding/compliance#tag/Questions-and-Answers/paths/~1v1~1question_set~1%7Bquestion_set_id%7D/get)) and prompt your customer to answer them in your frontend.
4. For **each question** in the set, call [PATCH Create answer for a question](/api-reference/onboarding/compliance#tag/Questions-and-Answers/paths/~1v1~1question_set~1%7Bquestion_set_id%7D~1questions~1%7Bquestion_id%7D~1answer/patch).
  * If the question requires the customer to **upload a document** (i.e., it has an `answer_type` value of `TEXT_AND_FILES`), use the [POST Upload a document for a person](/api-reference/onboarding/persons#tag/Person-documents/paths/~1v1~1persons~1%7Bperson_id%7D~1documents/post) or [POST Upload a document for a business](/api-reference/onboarding/businesses#tag/Business-documents/paths/~1v1~1businesses~1%7Bbusiness_id%7D~1documents/post) endpoint to upload it. Submit the **document ID** as a value of the `attachments` property in the answer.
5. Solaris reviews the answers. If further follow-up questions are necessary, Solaris will create a new `question_set` resource, and the process will restart from step 1.


Important
* Solaris will not review the answers until you create an answer for **each question** in the set and mark each one as `ready_for_review`.
* If a customer fails to answer all questions before the **deadline**, Solaris will initiate a [regular account closure](/guides/compliance/account-closure) shortly thereafter. Contact your Partner Manager for more information about this process.
* Solaris will not send reminders about the deadline; this responsibility falls on the partner.
* If the `recipient` of a question set is `PARTNER`, your support department must answer the questions. **Do not show these questions to the customer.**


## Q&A API endpoints

### PATCH Create an answer for a question

This endpoint creates an answer for a single question in a question set.

Note that Solaris will not review answers until you set the value of `ready_to_review` to `true` for **each question** in the question set.

**Request URL:**


```
PATCH /v1/question_set/{question_set_id}/questions/{question_id}/answer
```

**Request example:**


```json
{
  "response": "Here is my answer to the question",
  "partner_notes": "Optional notes",
  "attachments": [
    "4c9464a1a29cbb5cf6090463ef7f49b9cdoc",
    "876464a1a29cbb5cf6090463ef7f49a6cdoc"
  ],
  "ready_for_review": true
}
```

**Response example:**


```json
{
  "id": "1f0130f81d84ed3c75b32c428d5d7d93cqst",
  "question": "Provide your annual KYC report.",
  "answer_type": "TEXT_AND_FILES",
  "deadline": "2022-09-15T11:20:16.840208Z",
  "allowed_document_types": [
    "KYC_REPORT"
  ],
  "created_at": "2022-09-15T11:20:16.920885Z",
  "updated_at": "2022-09-15T11:20:16.920914Z",
  "answer": {
    "response": "Here is my annual KYC report",
    "partner_notes": "Optional partner notes",
    "attachments": [
      "4c9464a1a29cbb5cf6090463ef7f49b9cdoc"
    ],
    "ready_for_review": true
  }
}
```

[View full API reference](/api-reference/onboarding/compliance#tag/Questions-and-Answers/paths/~1v1~1question_set~1%7Bquestion_set_id%7D~1questions~1%7Bquestion_id%7D~1answer/patch)

### GET Retrieve questions in a question set

This endpoint returns an array containing each question in a question set.

**Request URL:**


```
GET /v1/questions/{question_set_id}
```

**Response example:**


```json
{
  "id": "b4897de4ad4142faa0a7822b84edf597cqset",
  "entity_id": "1fa130f81d84ed3c75b32c428d5d7d93cper",
  "context_id": "1fa130f81d84ed3c75b32c428d5d7d93ccnt",
  "description": "some description",
  "deadline": "2023-12-07T00:00:00Z",
  "recipient": {
    "recipient_id": "1fa130f81d84ed3c75b32c428d5d7d93cper",
    "recipient_type": "CUSTOMER"
  },
  "questions": [
    {
      "id": "1f0130f81d84ed3c75b32c428d5d7d93cqst",
      "question": "Provide your current address.",
      "answer_type": "TEXT_AND_FILES",
      "deadline": "2022-09-15T11:20:16.840208Z",
      "allowed_document_types": "KYC_REPORT"
    }
  ]
}
```

[View full API reference](/api-reference/onboarding/compliance#tag/Questions-and-Answers/paths/~1v1~1question_set~1%7Bquestion_set_id%7D/get)

## Testing

To test this feature, implement the following steps on one of the **testing environments**:

1. Create a person.
2. Complete customer KYC for the person.
3. Create a [suspicious device activity](/guides/kyc/device-monitoring#how-to-test-device-monitoring) using the suspicious test ID in the linked guide.


Solaris will auto-generate a question set for the customer, and you will receive a webhook notification as described above.