# Create a VisitReport report

Create a visit report for an event with the participant’s contact details. You can save questionnaire answers while the report is in progress and complete it when it’s ready.

An **event** supplies the questionnaire everyone uses. A **report** holds one interaction’s participants and answers. The first participant is the **parent participant**. Its ID identifies the report throughout this guide.

## Create the report

Set `EVENT_ID` to the ID from [Find events](/visitreport/events/) and `SNAPADDY_API_KEY` to a [personal API token](/authentication/). The token holder needs app access to create and upload reports.

Save this fictional contact as `participant.json`. The create endpoint spells the name fields `firstname` and `lastname`. The contact uses empty strings for unused text fields, `-1` for unknown gender, and empty objects for `customFields` and `meta`.

See the [API reference](/reference/visitreport-reports/) for the full request schema.

```json
{
  "firstname": "Alex", "lastname": "Morgan", "organization": "Northstar Systems",
  "email": "alex@example.com", "quickScan": false, "customFields": {}, "meta": {},
  "city": "", "contactSource": null, "country": "", "fax": "", "gender": -1,
  "linkedIn": "", "mobile": "", "note": "", "phone": "", "poBox": "",
  "position": "", "state": "", "street": "", "street2": "", "title": "",
  "vat": "", "website": "", "zip": ""
}
```

Send the contact once. A successful request creates an unfinished report and returns `201`. Save the returned `participantId` as `REPORT_ID` before submitting answers. Repeating this POST creates another report.

```bash
curl --fail-with-body --silent --show-error -X POST \
  "https://backend.snapaddy.com/questionnaire/v1/$EVENT_ID/report/create" \
  -H "x-api-key: $SNAPADDY_API_KEY" -H "Content-Type: application/json" --data-binary @participant.json | jq '.participantId'
```

```typescript
import { readFile } from "node:fs/promises";

const response = await fetch(`https://backend.snapaddy.com/questionnaire/v1/${encodeURIComponent(process.env.EVENT_ID!)}/report/create`, {
  method: "POST", headers: { "x-api-key": process.env.SNAPADDY_API_KEY!, "Content-Type": "application/json" },
  body: await readFile("participant.json", "utf8"),
});
if (!response.ok) throw new Error(`Request failed (${response.status}): ${await response.text()}`);
const data = await response.json();
console.log(data.participantId);
```

```python
import json
import os
from pathlib import Path
from urllib.parse import quote
from urllib.request import Request, urlopen

url = f"https://backend.snapaddy.com/questionnaire/v1/{quote(os.environ['EVENT_ID'], safe='')}/report/create"
request = Request(url, method="POST", headers={"x-api-key": os.environ["SNAPADDY_API_KEY"], "Content-Type": "application/json"},
                  data=Path("participant.json").read_bytes())
with urlopen(request, timeout=20) as response:
    data = json.load(response)
print(data["participantId"])
```

Your report is now saved in progress. You can stop here or add questionnaire answers.

## Find the question and its input

To prefill an answer, choose a text or multiline text question in the event. Read the event and look under `questionGroups[].questions[]`. For this example, find the prompt **What should we follow up on?** under the event’s language in `texts`. Store the question’s `id` as `QUESTION_ID` and its input option’s `id` as `OPTION_ID`. Use IDs from this event even when another event displays the same prompt.

```bash
curl --fail-with-body --silent --show-error \
  "https://backend.snapaddy.com/questionnaire/v1/$EVENT_ID" \
  -H "x-api-key: $SNAPADDY_API_KEY" | jq '.questionGroups[] | .questions[] | select(.questionType == "Text" or .questionType == "Textarea") | {id, texts, questionOptions: [.questionOptions[] | {id, questionOptionType}]}'
```

```typescript
const response = await fetch(`https://backend.snapaddy.com/questionnaire/v1/${encodeURIComponent(process.env.EVENT_ID!)}`, {
  method: "GET", headers: { "x-api-key": process.env.SNAPADDY_API_KEY! },
});
if (!response.ok) throw new Error(`Request failed (${response.status}): ${await response.text()}`);
const data = await response.json();
for (const group of data.questionGroups) {
  for (const q of group.questions) {
    if (["Text", "Textarea"].includes(q.questionType)) console.log(q.id, q.texts, q.questionOptions);
  }
}
```

```python
import json
import os
from urllib.parse import quote
from urllib.request import Request, urlopen

url = f"https://backend.snapaddy.com/questionnaire/v1/{quote(os.environ['EVENT_ID'], safe='')}"
request = Request(url, method="GET", headers={"x-api-key": os.environ["SNAPADDY_API_KEY"]})
with urlopen(request, timeout=20) as response:
    data = json.load(response)
for group in data["questionGroups"]:
    for q in group["questions"]:
        if q["questionType"] in ("Text", "Textarea"):
            print(q["id"], q["texts"], q["questionOptions"])
```

## Prefill the answer

Build the upload for the report you just created. A top-level question uses `parentQuestionOptionId: null`. Even for a free-text question, put the value in `options[].text` alongside its `questionOptionId`.

See the [API reference](/reference/visitreport-reports/) for the full request schema.

```bash
jq -n --slurpfile participant participant.json --arg report "$REPORT_ID" \
  --arg question "$QUESTION_ID" --arg option "$OPTION_ID" '{
    participants: {parent: ($participant[0] + {participantId:$report}), children: []},
    answers: [{questionId:$question, parentQuestionOptionId:null,
              options:[{questionOptionId:$option, text:"Send pricing for the autumn rollout."}]}]
  }' > upload.json
```

```typescript
import { readFile, writeFile } from "node:fs/promises";

const participant = JSON.parse(await readFile("participant.json", "utf8"));
const upload = {
  participants: { parent: { ...participant, participantId: process.env.REPORT_ID! }, children: [] },
  answers: [{ questionId: process.env.QUESTION_ID!, parentQuestionOptionId: null,
    options: [{ questionOptionId: process.env.OPTION_ID!, text: "Send pricing for the autumn rollout." }] }],
};
await writeFile("upload.json", JSON.stringify(upload));
```

```python
import json, os
from pathlib import Path

parent = json.loads(Path("participant.json").read_text())
parent["participantId"] = os.environ["REPORT_ID"]
answer = {"questionId": os.environ["QUESTION_ID"], "parentQuestionOptionId": None,
          "options": [{"questionOptionId": os.environ["OPTION_ID"], "text": "Send pricing for the autumn rollout."}]}
Path("upload.json").write_text(json.dumps({"participants": {"parent": parent, "children": []}, "answers": [answer]}))
```

Send the upload to save the answers. A full upload replaces the participant and answer collections. For an existing report, [read its current snapshot](/visitreport/reports/#create-save-and-complete-a-report) and include the participants and answers you want to keep. To replace just the answers, use `PUT /v1/report/{reportId}/answers` with dashboard access. That request preserves the participants.

The report stays **In Progress** after upload. [Complete it in VisitReport](#complete-the-report-in-visitreport) when it’s ready, or [hand it over](#hand-the-unfinished-report-to-a-colleague) for a colleague to continue.

```bash
curl --fail-with-body --silent --show-error -X PUT \
  "https://backend.snapaddy.com/questionnaire/v1/report/$REPORT_ID/upload" \
  -H "x-api-key: $SNAPADDY_API_KEY" -H "Content-Type: application/json" --data-binary @upload.json
```

```typescript
import { readFile } from "node:fs/promises";

const response = await fetch(`https://backend.snapaddy.com/questionnaire/v1/report/${encodeURIComponent(process.env.REPORT_ID!)}/upload`, {
  method: "PUT", headers: { "x-api-key": process.env.SNAPADDY_API_KEY!, "Content-Type": "application/json" },
  body: await readFile("upload.json", "utf8"),
});
if (!response.ok) throw new Error(`Request failed (${response.status}): ${await response.text()}`);
console.log(response.status);
```

```python
import os
from pathlib import Path
from urllib.parse import quote
from urllib.request import Request, urlopen

url = f"https://backend.snapaddy.com/questionnaire/v1/report/{quote(os.environ['REPORT_ID'], safe='')}/upload"
request = Request(url, method="PUT", headers={"x-api-key": os.environ["SNAPADDY_API_KEY"], "Content-Type": "application/json"},
                  data=Path("upload.json").read_bytes())
with urlopen(request, timeout=20) as response:
    print(response.status)
```

## Hand the unfinished report to a colleague

For example, a visitor asks for pricing before a trade show. Your integration can prefill that request and hand the unfinished report to the salesperson who will meet them.

Enable report handover in the event settings.

1. When creating a custom event, choose **Events → Create event → Custom event → Additional features → Team coordination**.
2. Open **Team coordination → Settings** and check **Enable handing over reports in the app**. The API exposes this setting as `handoverEnabled`.
3. Publish the event and give the receiving colleague app access.

Keep the report unfinished when someone else will continue it. List recipients and choose the colleague by their `username` or `fullName`. Set `RECIPIENT_ID` to that person’s `userId`. The service checks the recipient’s organization membership and event access again when you submit the handover.

See the [API reference](/reference/visitreport-reports/) for the full request schema.

```bash
curl --fail-with-body --silent --show-error \
  "https://backend.snapaddy.com/questionnaire/v1/report/$REPORT_ID/handover/recipients" \
  -H "x-api-key: $SNAPADDY_API_KEY" | jq '.recipients[] | {fullName, username, userId}'
```

```typescript
const response = await fetch(`https://backend.snapaddy.com/questionnaire/v1/report/${encodeURIComponent(process.env.REPORT_ID!)}/handover/recipients`, {
  method: "GET", headers: { "x-api-key": process.env.SNAPADDY_API_KEY! },
});
if (!response.ok) throw new Error(`Request failed (${response.status}): ${await response.text()}`);
const data = await response.json();
console.log(data.recipients);
```

```python
import json
import os
from urllib.parse import quote
from urllib.request import Request, urlopen

url = f"https://backend.snapaddy.com/questionnaire/v1/report/{quote(os.environ['REPORT_ID'], safe='')}/handover/recipients"
request = Request(url, method="GET", headers={"x-api-key": os.environ["SNAPADDY_API_KEY"]})
with urlopen(request, timeout=20) as response:
    data = json.load(response)
print(data["recipients"])
```

Hand over the report using the sender’s token. A successful request returns `204` with an empty body. VisitReport can notify the recipient on a registered device.

```bash
curl --fail-with-body --silent --show-error -X POST \
  "https://backend.snapaddy.com/questionnaire/v1/report/$REPORT_ID/handover/recipient/$RECIPIENT_ID" \
  -H "x-api-key: $SNAPADDY_API_KEY" --write-out '%{http_code}\n'
```

```typescript
const response = await fetch(`https://backend.snapaddy.com/questionnaire/v1/report/${encodeURIComponent(process.env.REPORT_ID!)}/handover/recipient/${encodeURIComponent(process.env.RECIPIENT_ID!)}`, {
  method: "POST", headers: { "x-api-key": process.env.SNAPADDY_API_KEY! },
});
if (!response.ok) throw new Error(`Request failed (${response.status}): ${await response.text()}`);
console.log(response.status);
```

```python
import os
from urllib.parse import quote
from urllib.request import Request, urlopen

url = f"https://backend.snapaddy.com/questionnaire/v1/report/{quote(os.environ['REPORT_ID'], safe='')}/handover/recipient/{quote(os.environ['RECIPIENT_ID'], safe='')}"
request = Request(url, method="POST", headers={"x-api-key": os.environ["SNAPADDY_API_KEY"]})
with urlopen(request, timeout=20) as response:
    print(response.status)
```

### Open the report in VisitReport

In the event, open **Reports → Received reports → Alex Morgan**. The **Participants** screen shows Alex at Northstar Systems. Tap **Start questionnaire** and open **Discovery** to see the prefilled answer. The recipient can edit the answer and continue the conversation before completing the report.

<img src="/images/visitreport-questionnaires/recipient-prefilled-report.png" alt="VisitReport recipient view showing Alex Morgan at Northstar Systems on the Participants screen, then the Discovery question with the answer “Send pricing for the autumn rollout.”" width="816" height="524" />

Handover requires an unfinished report, its parent participant ID, and a recipient other than the sender. A disabled event handover, a completed report, or an attempt to hand a report to yourself returns `409`. If a listed colleague gets rejected with `403`, check their event app access and the event’s availability.

## Complete the report in VisitReport

- **App.** Open the event and find the report under **Reports → In Progress**. Choose **Complete** once all required fields are filled. [Completing reports in the app](https://portal.snapaddy.com/knowledge/how-do-i-export-the-visitor-reports-from-the-visitreport-app)
- **Dashboard.** For a live event, open **Reports → In Progress**, hover over the report, and choose **Complete Report**. Confirm with **Complete**. [Completing reports in the dashboard](https://portal.snapaddy.com/knowledge/reports-in-progress-and-completed)

A completed report is no longer eligible for handover.

[Questionnaire structure reference](/reference/visitreport-questionnaire/) · [Report and handover reference](/reference/visitreport-reports/)
