---
schema_version: "1"
id: ab5c81a9f3c86914a0ccdd52777ec0a1082480ed0e2e9a995ec964d2d34db04c
title: |-
  Contact Encounter
      (POST)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/life_sciences_dev_guide/hc_erm_resource_contact_encounter_business_api.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/hc_erm_resource_contact_encounter_business_api.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 77616744aae71b0c6d22736585029510abeb0418eb102483aec423d6b42d4392
description: Load details of contact encounters into the system.
---
# Contact Encounter (POST)

Load details of contact encounters into the system.

## Prerequisites

- This API must be used only for person account-enabled orgs.
- Ensure that you have access to the Contact Encounter fields and the Contact Encounter Participants fields in your org.

## Contact Tracing Encounters and Participants

- To create a new encounter, set the referenceID field to null.
- To update an existing encounter with details of new encounter participants, pass the referenceID of the encounter in the payload.
- A single payload can have a maximum of 5 encounters.
- A single payload can have a maximum of 50 participants per encounter.
- Encounter participants are not mandatory. If a participant is specified, the participant type is mandatory. If the participant type is set to lead, the participant’s first name and last name are mandatory.

## Resource

/services/data/vXX.X/contact-tracing

## Available Version

49.0 and later

## Authentication

Replace TOKEN with the OAuth access token.

Authorization: Bearer **TOKEN**

![Note](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/images/icon_note.png)

#### Note

The Lightning Platform REST API supports OAuth 2.0 (an open protocol to allow secure API authorization). See [Authorize Apps with OAuth](https://help.salesforce.com/articleView?id=remoteaccess_authenticate.htm&language=en_US "HTML (New Window)") in Salesforce Help for more details.

## HTTP Methods

POST

## Request Body

**JSON Example**

{
    contactTracingEncounters: \[
        {
            "referenceId":"0haRM000000000BYAQ",
            "name":"SF All Hands Q2"
            "estimatedParticipantCount": 10,
            "startDateTime" : "2020-06-20T00:00:00Z",
            "duration": 12,
            "description" : "held in SF tower",
            "participants" : \[
                {
                    "participantType": "lead",
                    "recordTypeName": "triage",
                    "startTime": "2020-06-20T00:00:00Z",
                    "duration": 12,
                    "firstName" : "Leo",
                    "lastName" : "Machado",
                    "age" : 24,
                    "phoneNumber" : "24323322",
                    "emailAddress" : "lee.lo@mail.com",
                    "address":{
                        "city":"Seattle",
                        "state":"Washington",
                        "country":"US",
                        "postalCode":"11404",
                        "street":"Richmond St"
                    }
                },
                {
                    "participantType": "patient"
                    "referenceId":"001RM000004iUi8YAE",
                    "sourceSystemId":"211453",
                    "startTime": "2020-06-20T00:00:00Z",
                    "duration": 10,
                    "age" : 34
                }
            \],
            "location" : {
                "name":"Seattle County",
                "description":"Gala event",
                "latitude" : "47.6" ,
                "longitude": "122.3",
                "encounterAddress":{
                        "city":"Seattle",
                        "state":"Washington",
                        "country":"US",
                        "postalCode":"11404",
                        "street":"Dutch St"
                    }
            }

        }
    \]
    
}

**Properties**

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader vertical-align-top " id="d226652e167">Name</th>

              <th class="featureTableHeader vertical-align-top " id="d226652e170">Type</th>

              <th class="featureTableHeader vertical-align-top " id="d226652e173">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​referenceId</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The ID of an existing contact encounter record in the Salesforce
                system.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​name</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">Required. The name for the encounter.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​estimatedParticipantCount</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">Integer</td>

              <td class="entry" headers="d226652e173" data-title="Description">The estimated number of participants in the encounter.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​startDateTime</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">DateTime</td>

              <td class="entry" headers="d226652e173" data-title="Description">Required. The start date and time of the encounter. Must be in
                YYYY-MM-DDT HH:MM:SS format. For example, 2020-05-18T09:15:00.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​duration</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">Integer</td>

              <td class="entry" headers="d226652e173" data-title="Description">Required. The duration of the encounter in minutes.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​description</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The description for the encounter.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">List</td>

              <td class="entry" headers="d226652e173" data-title="Description">The list of participants for the contact encounter. Each element in
                the list represents <samp class="codeph nolang">ContactEncounterParticipant</samp>. Valid values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">lead</samp></li>

                  <li class="li"><samp class="codeph nolang">employee</samp></li>

                  <li class="li"><samp class="codeph nolang">patient</samp></li>

                </ul>
                <p class="p">Note: Only one value is allowed.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">Required. The encounter participant type. Valid values are: <ul class="ul bulletList">
                  <li class="li">Lead— A new lead is created with the specified participant
                    record type. If the record type does not exist in the org, an error
                    message is returned. If the record type is not provided n the
                    payload, the default record type (triage) is used.</li>

                  <li class="li">Employee— The system performs a lookup to the person
                    account and the record type is ignored. This lookup can be done in
                    the following ways: <ul class="ul bulletList">
                      <li class="li">Using the <samp class="codeph nolang">referenceId</samp>
                        that corresponds to the Salesforce record ID.</li>

                      <li class="li">Using <samp class="codeph nolang">sourceSystemId</samp>. For
                        an employee, this ID is typically the employee ID or employee
                        number. If a match is found, the contact encounter participant
                        record is created with the <samp class="codeph nolang">contact</samp> field lookup pointing to the matched person
                        account. If a match is not found, this record is rejected and an
                        error message is provided in the response. </li>

                    </ul>
                  </li>

                  <li class="li">Patient—The system performs a lookup to the person account
                    and the record type is ignored. This lookup can be done in the
                    following ways: <ul class="ul bulletList">
                      <li class="li">Using the <samp class="codeph nolang">referenceId</samp>
                        that corresponds to the Salesforce record ID.</li>

                      <li class="li">Using <samp class="codeph nolang">sourceSystemId</samp>. For
                        a patient, this ID is the patient ID from an external source
                        system. If a match is found, the contact encounter participant
                        record is created with the <samp class="codeph nolang">contact_id</samp> lookup pointing to the matched person
                        account. If a match is not found, this record is rejected and an
                        error message is provided in the response. </li>

                    </ul>
                  </li>

                </ul>
                <p class="p">Note: Only one value is allowed.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.referenceId</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The ID of an existing patient or employee record in the Salesforce
                system. If a payload has both the <samp class="codeph nolang">referenceID</samp> and the <samp class="codeph nolang">sourceSystemID</samp>, the <samp class="codeph nolang">referenceID</samp> is used for the patient or the employee
                lookup.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.sourceSystemId</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">For a patient, the patient ID from an external source system at
                participant level. For an employee, the employee number representing the
                employee record in the Salesforce or the external system. If a payload
                has both the <samp class="codeph nolang">referenceID</samp> and the
                <samp class="codeph nolang">sourceSystemID</samp>, the <samp class="codeph nolang">referenceID</samp> is used for the patient or
                employee lookup.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.recordTypeName</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The name for the record type. The value for this field must be
                exactly the same as the label of the record type in the user interface.
                This field is used only when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                is set to <samp class="codeph nolang">lead</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.startTime</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">DateTime</td>

              <td class="entry" headers="d226652e173" data-title="Description">The time when the encounter started.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.duration</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">Integer</td>

              <td class="entry" headers="d226652e173" data-title="Description">Required. The duration of the encounter in minutes.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.firstName</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">Required. The first name of the participant. This field is used
                only when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                is set to <samp class="codeph nolang">lead</samp>.<p class="p">Note: If
                  <samp class="codeph nolang">participants.referenceId</samp> is
                  provided, this field is optional.
                </p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.lastName</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">Required. The last name of the encounter participant. This field is
                used only when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                is set to <samp class="codeph nolang">lead</samp>.<p class="p">Note: If
                  <samp class="codeph nolang">participants.referenceId</samp> is
                  provided, this field is optional.
                </p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.age</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">Integer</td>

              <td class="entry" headers="d226652e173" data-title="Description">The age of the encounter participant.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.phoneNumber</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The phone number of the encounter participant. This field is used
                only when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                is set to <samp class="codeph nolang">lead</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.emailAddress</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The email address of the encounter participant. This field is used
                only when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>​
                is set to <samp class="codeph nolang">lead</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.address</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The address of the encounter participant. This field is used only
                when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                ​is set to <samp class="codeph nolang">lead</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.address.city</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The city of the encounter participant. This field is used only when
                <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                ​is set to <samp class="codeph nolang">lead</samp>.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.address.state</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The state of the encounter participant. This field is used only
                when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                ​is set to <samp class="codeph nolang">lead</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.address.country</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The country of the encounter participant. This field is used only
                when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                ​is set to <samp class="codeph nolang">lead</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.address.postalCode</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The postal code of the encounter participant. This field is used
                only when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                ​is set to <samp class="codeph nolang">lead</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​participants.address.street</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The street of the encounter participant. This field is used only
                when <samp class="codeph nolang">contactTracingEncounters.​participants.participantType</samp>
                ​is set to <samp class="codeph nolang">lead</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">Object (reference to location)</td>

              <td class="entry" headers="d226652e173" data-title="Description">Identifies the location of the encounter.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.name</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">Required. The name of the location where the encounter took place.
                If the encounter location name already exists in the system, the
                existing location record is used and the following location fields are ignored:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">contactTracingEncounters.​location.description</samp></li>

                  <li class="li"><samp class="codeph nolang">contactTracingEncounters.​location.latitude</samp></li>

                  <li class="li"><samp class="codeph nolang">contactTracingEncounters.​location.longitude</samp></li>

                  <li class="li"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.city</samp></li>

                  <li class="li"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.state</samp></li>

                  <li class="li"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.country</samp></li>

                  <li class="li"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.postalCode</samp></li>

                  <li class="li"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.street</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.description</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The description of the location where the encounter took
                place.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.latitude</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The latitude coordinate of the location where the encounter took
                place.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.longitude</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The longitude coordinate of the location where the encounter took
                place.</td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.city</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The city where the encounter took place. </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.state</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The state where the encounter took place. </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.country</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The country where the encounter took place. </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.postalCode</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The postal code of the location where the encounter took place.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d226652e167" data-title="Name"><samp class="codeph nolang">contactTracingEncounters.​location.encounteraddress.street</samp></td>

              <td class="entry" headers="d226652e170" data-title="Type">String</td>

              <td class="entry" headers="d226652e173" data-title="Description">The street where the encounter took place. </td>

            </tr>

          </tbody>

        </table>

## Response Body

**JSON Example**

{
  "encounters" : \[ {
    "created" : false,
    "id" : "0haxx00000000rFAAQ",
    "location" : null,
    "participants" : \[ {
      "created" : true,
      "employee" : null,
      "errors" : null,
      "id" : "0hbxx00000000G9AAI",
      "lead" : {
        "created" : true,
        "id" : "00Qxx000002TST8EAO"
      },
      "patient" : null
    }, {
      "created" : true,
      "employee" : null,
      "errors" : null,
      "id" : "0hbxx00000000GAAAY",
      "lead" : {
        "created" : true,
        "id" : "00Qxx000002TST9EAO"
      },
      "patient" : null
    }, {
      "created" : true,
      "employee" : null,
      "errors" : null,
      "id" : "0hbxx00000000GBAAY",
      "lead" : null,
      "patient" : {
        "created" : false,
        "id" : "001xx000003GZ6tAAG"
      }
    } \]
  } \],
  "errors" : null,
  "status" : null,
  "success" : true
}