# Manage VisitReport inventory data

Inventory data gives VisitReport users an address book of known contacts. Choose a **global list** to share CRM contacts across events, or an **event-specific list** for one event’s guest list.

Both examples use a [personal API token](/authentication/) in `SNAPADDY_API_KEY`. Upload 1–5,000 contacts per batch. Save the returned `contactIds` alongside your CRM IDs: sending the same email again creates another contact.

## Global list (shared across events)

1. Open **VisitReport → Inventory data → Create inventory data list**. Name the list (for example, **Spring Expo visitors**) and choose **Create**. An organization administrator, Event Manager, or Event Curator can create this list.

   <img src="/images/visitreport-inventory/create-list.png" alt="Create inventory data list dialog with Spring Expo visitors entered as the name" width="360" height="215" />

2. Open the list. Copy the last segment of `/visitreport/global-inventory-data/LIST_ID` from the address bar and set it as `LIST_ID`.
3. In each event that should use the list, open **Inventory data → Activate inventory data**. Choose **Predefined inventory data list**, select your list, and choose **Activate**.

   <img src="/images/visitreport-inventory/select-source.png" alt="Select inventory data source with the predefined Spring Expo visitors list selected" width="360" height="267" />

Upload contacts using the **list ID**. Changes reach every event that uses this list.

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

```bash
curl --fail-with-body "https://backend.snapaddy.com/questionnaire/global-inventory-data/v1/$LIST_ID/contacts/create/batch" \
  -H "x-api-key: $SNAPADDY_API_KEY" -H 'Content-Type: application/json' \
  --data '{"contacts":[{"firstName":"Alex","lastName":"Morgan","email":"alex@example.com"}]}'
```

```typescript
const response = await fetch(`https://backend.snapaddy.com/questionnaire/global-inventory-data/v1/${process.env.LIST_ID}/contacts/create/batch`, {
  method: "POST",
  headers: { "x-api-key": process.env.SNAPADDY_API_KEY!, "Content-Type": "application/json" },
  body: JSON.stringify({ contacts: [{ firstName: "Alex", lastName: "Morgan", email: "alex@example.com" }] }),
});
if (!response.ok) throw new Error(await response.text());
console.log((await response.json()).contactIds);
```

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

contact = {"firstName": "Alex", "lastName": "Morgan", "email": "alex@example.com"}
request = Request(f"https://backend.snapaddy.com/questionnaire/global-inventory-data/v1/{os.environ['LIST_ID']}/contacts/create/batch",
                  data=json.dumps({"contacts": [contact]}).encode(),
                  headers={"x-api-key": os.environ["SNAPADDY_API_KEY"], "Content-Type": "application/json"})
with urlopen(request, timeout=20) as response:
    print(json.load(response)["contactIds"])
```

To update Alex’s city, send `PATCH /questionnaire/global-inventory-data/v1/{listId}/contacts/update/{contactId}` with `{"city":"Berlin"}`. Use the contact ID from the upload response. To review the list, call `GET /questionnaire/global-inventory-data/v1/{listId}/contacts`.

**API setup:** To automate list creation, send `POST /questionnaire/global-inventory-data/v1` with `{"listName":"Spring Expo visitors"}`. Use the returned `listId` as `contactListId` when calling `POST /questionnaire/global-inventory-data/v1/activate` with `contactListId` and `questionnaireId` (the event ID).

## Event-specific list (one event)

1. Open **VisitReport → Events**, select the event, and open **Inventory data → Activate inventory data**.

   <img src="/images/visitreport-inventory/event-activate.png" alt="Event inventory data page with the Activate inventory data button" width="360" height="166" />

2. Choose **Event-specific inventory data**, then **Activate**.

   <img src="/images/visitreport-inventory/event-source.png" alt="Event-specific inventory data selected and the Activate button enabled" width="360" height="226" />
3. Copy the value between `events/` and `/inventory-data` in the address bar: `/visitreport/events/EVENT_ID/inventory-data`. Set it as `EVENT_ID`.
4. To verify the setup, call `GET /questionnaire/inventory-data/v1/{eventId}/list`. Check the list name and that `isGlobal` is `false`.

Upload contacts using the **event ID** and a token from an account whose VisitReport role can edit that event.

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

```bash
curl --fail-with-body "https://backend.snapaddy.com/questionnaire/inventory-data/v1/$EVENT_ID/contacts/create/batch" \
  -H "x-api-key: $SNAPADDY_API_KEY" -H 'Content-Type: application/json' \
  --data '{"contacts":[{"firstName":"Alex","lastName":"Morgan","email":"alex@example.com"}]}'
```

```typescript
const response = await fetch(`https://backend.snapaddy.com/questionnaire/inventory-data/v1/${process.env.EVENT_ID}/contacts/create/batch`, {
  method: "POST",
  headers: { "x-api-key": process.env.SNAPADDY_API_KEY!, "Content-Type": "application/json" },
  body: JSON.stringify({ contacts: [{ firstName: "Alex", lastName: "Morgan", email: "alex@example.com" }] }),
});
if (!response.ok) throw new Error(await response.text());
console.log((await response.json()).contactIds);
```

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

contact = {"firstName": "Alex", "lastName": "Morgan", "email": "alex@example.com"}
request = Request(f"https://backend.snapaddy.com/questionnaire/inventory-data/v1/{os.environ['EVENT_ID']}/contacts/create/batch",
                  data=json.dumps({"contacts": [contact]}).encode(),
                  headers={"x-api-key": os.environ["SNAPADDY_API_KEY"], "Content-Type": "application/json"})
with urlopen(request, timeout=20) as response:
    print(json.load(response)["contactIds"])
```

To update Alex’s city, send `PATCH /questionnaire/inventory-data/v1/{eventId}/contacts/update/{contactId}` with `{"city":"Berlin"}`, using the contact ID from the upload response. To review the event’s contacts, call `GET /questionnaire/inventory-data/v1/{eventId}/contacts`.

**API setup:** If the event has no list (`404 NO_INVENTORY_DATA`), send `POST /questionnaire/inventory-data/v1/{eventId}/list/create` with `{"listName":"Spring Expo visitors"}` to create and assign one.

[Inventory data API reference](/reference/visitreport-inventory-data/)
