> ## Documentation Index
> Fetch the complete documentation index at: https://docs.auxia.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Log Treatment Interactions

> This API enables your team to monitor how your users are engaging with the touchpoints you distribute through Auxia.

This API enables your team to monitor how your users are engaging with the touchpoints you distribute through Auxia.

## API Definition

```
POST https://apis.auxia.io/v1/LogTreatmentInteraction
```

#### Path Parameters

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>api-key</td>
      <td>String</td>

      <td>
        A string API key that is issued to each project or company that uses Auxia. This key should have permission to call this API. This can be either set in the request parameters or in the header.
      </td>
    </tr>
  </tbody>
</table>

#### Headers

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>x-api-key</td>
      <td>String</td>

      <td>
        A string API key that is issued to each project or company that uses Auxia. This API key should have permission to call this API. This can be either set in the request parameters or the header.
      </td>
    </tr>
  </tbody>
</table>

### Raw request body

```json lines theme={null}
{
    "projectId": "1250",
    "userId": "gGTE8CWUIgpzPivCejVk7JN284V",
    "treatmentTrackingId": "6_690e24d8-16a6-4518-bf37-09a8f0120dfb",
    "treatmentId": "1250",
    "surface": "HOME_SCREEN",
    "interactionType": "CLICKED",
    "interactionTimeMicros": 1667829258250000,
    "actionName": "Buy Now"    
}
```

### Example Curl

```json lines theme={null}
curl --location --request POST 'https://apis.auxia.io/v1/LogTreatmentInteraction' \
--header 'Content-Type: application/json, x-api-key: ****************' \
--data-raw '{
    "projectId": "1250",
    "userId": "gGTE8CWUIgpzPivCejVk7JN284V",
    "treatmentTrackingId": "6_690e24d8-16a6-4518-bf37-09a8f0120dfb",
    "treatmentId": "1250",
    "surface": "HOME_SCREEN"
    "interactionType": "CLICKED",
    "interactionTimeMicros": 1667829258250000,
    "actionName": "Buy Now"
}'
```

### Response

```json lines theme={null}
{ }
```

## Schema reference

### Request

This API may be called multiple times for each treatment\_tracking\_id for different interactions or recurring interactions.

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Data Type</th>
      <th>Required?</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>projectId</td>
      <td>String</td>
      <td>Required</td>
      <td>For a given customer's project, this should always be the same.</td>
    </tr>

    <tr>
      <td>userId</td>
      <td>string</td>
      <td>Required</td>
      <td>Unique ID for the user whose interaction is being logged. This field is new - optional until the clients are migrated to start using it.</td>
    </tr>

    <tr>
      <td>treatmentTrackingId</td>
      <td>String</td>
      <td>Required</td>
      <td>A unique ID that is obtained for each treatment returned by the getTreatments API. This can be passed back in this API to complete the feedback loop.</td>
    </tr>

    <tr>
      <td>treatmentId</td>
      <td>string</td>
      <td>Required</td>
      <td>Unique ID of the treatment for which interaction is being logged returned by the getTreatments API. This can be passed back in this API to complete the feedback loop. Treatment ID is used for efficient matching with treatments returned by GetTreatments API. But if it adds complexity in passing it around, please discuss with Auxia to make this optional. This field is new - optional until the clients are migrated to start using it.</td>
    </tr>

    <tr>
      <td>surface</td>
      <td>string</td>
      <td>Required</td>
      <td>The name of the surface on which the treatment is rendered. This field is new - optional until the clients are migrated to start using it.</td>
    </tr>

    <tr>
      <td>interactionType</td>
      <td>String</td>
      <td>Required</td>
      <td>This specifies the type of interaction. Supported values include: VIEWED, CLICKED, SNOOZED, DISMISSED, CTA\_COMPLETED, SWIPE. For email treatments the following delivery-outcome values are also supported: DELIVERY\_SENT, DELIVERED, BOUNCED, HARD\_BOUNCED, SOFT\_BOUNCED, DROPPED, SPAM\_REPORTED, UNSUBSCRIBED, GROUP\_UNSUBSCRIBED, GROUP\_RESUBSCRIBED.</td>
    </tr>

    <tr>
      <td>interactionTimeMicros</td>
      <td>Int64</td>
      <td>Required</td>
      <td>This indicates the time at which the interaction occurred. Please ensure the timestamp matches the timestamp recorded by your analytics events (e.g. Amplitude, Firebase, etc). This represents the number of microseconds of UTC time after Unix epoch.</td>
    </tr>

    <tr>
      <td>actionName</td>
      <td>String</td>
      <td>Optional</td>
      <td>Indicates the action associated with the user tap/click/swipe.</td>
    </tr>
  </tbody>
</table>

### Response

An empty response indicates that the RPC was completed successfully
