# Single Events

From the product’s cloud instance, we get the following data

* Unique User ID (email, Social, LinkedIn, GitHub, Username)
* IP Address
* Activity Details
* Login Timestamp

We will be able to enrich the users using

* email ID, GitHub, LinkedIn
* IP Address

and find out the company to which the user belongs to. With the unique user ID, we will aggregate the product usage at a developer level and ultimately map it to the company to which the user(s) are associated.&#x20;

{% hint style="info" %}
**Important Note:** The Product API integration is fully dependent on the configuration of custom metrics in the **Product Usage Settings**.\
Without these metrics, data sent via the API will not be received or processed in the Reo.Dev platform. Please refer to [How to Configure Product Usage Metrics in Settings](https://docs.reo.dev/configurations/product-usage) to ensure your metrics are correctly set up before implementing the Product API.
{% endhint %}

### **API Structure**

| **Header**   | **Description**                                         | **Data type** |
| ------------ | ------------------------------------------------------- | ------------- |
| X-API-KEY    | Generated Reo.Dev \<API\_KEY> for authorization.        | string        |
| Content-Type | Request content-type is always set to application/json. | string        |

```
curl --location 'https://ingest.reo.dev/api/product/usage' \
--header 'X-API-KEY: <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "payload": {
	"activity_type": "LOGIN_ACTIVITY",
	"source": "PRODUCT_CLOUD",        
	"environment": "PRODUCTION",
        "user_id": "https://www.linkedin.com/in/userid",
        "user_id_type":"LINKEDIN",
        "ip_addr": "156.59.87.83",
        "event_id": 1231231232,  
        "event_at": 639303296,  
        "product_id": "reoWebApp",
        "user_agent": "Mozilla/5.0 (Macintosh, Intel Mac OS X 10_15_7) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
        "meta": {"property1":"value1","property2":"value2"}
    }
}'
```

### **Tenant API Key**

To access your API key, navigate to:

**Settings → Integrations → API Keys → Product Usage API**

* **Admins** can generate and copy the key
* **Non-admin users** can only view and copy the existing key

<figure><img src="https://2705882080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fx46P5sAHxDG7PqOdVLxI%2Fuploads%2FAMigS6C5kqLpbgFAVa7I%2Fimage.png?alt=media&#x26;token=a2d58896-9e31-47cf-b080-4d577e15a374" alt=""><figcaption></figcaption></figure>

| Parameter                      | Description                                                                                                                                                                                               | Datatype | Allowed Values                                      | Example                                                             |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------- | ------------------------------------------------------------------- |
| **source (Required)**          | Source of the activity.                                                                                                                                                                                   | enum     | `PRODUCT_CLOUD`                                     | `"PRODUCT_CLOUD"`                                                   |
| **activity\_type (Required)**  | Usage Metrics of the product. The definition of primary, secondary1 and secondary2 should match with metrics defined in the Reo.Dev settings. If no data is available, activity type can be `"CALL HOME"` | string   | Keys defined in metrics                             | `"API KEY GENERATED"`                                               |
| **environment (optional)**     | Environment where product has been deployed.                                                                                                                                                              | string   | ​                                                   | `"production"`                                                      |
| **user\_id\_type (mandatory)** | Type of user ID such as email, Social, LinkedIn, GitHub, Username.                                                                                                                                        | enum     | `EMAIL`, `SOCIAL`, `LINKEDIN`, `GITHUB`, `USERNAME` | `"EMAIL"`                                                           |
| **user\_id (mandatory)**       | Unique user ID captured for a customer.                                                                                                                                                                   | string   | ​                                                   | `"michaelbevan"`                                                    |
| **ip\_addr (optional)**        | IP address of the system from where the user has logged in.                                                                                                                                               | string   | ​                                                   | `"192.127.0.0"`                                                     |
| **event\_id (optional)**       | A unique identifier for the event for Tenant for filter.                                                                                                                                                  | string   | ​                                                   | `193ef456430`                                                       |
| **event\_at (mandatory)**      | The time at which the event occurred (Formatted as a UNIX epoch in seconds).                                                                                                                              | integer  | ​                                                   | `639303296`                                                         |
| **product\_id (Required)**     | Unique identifier of your product.                                                                                                                                                                        | string   | ​                                                   | `"reoWebApp"`                                                       |
| **user\_agent (optional)**     | Additional browser properties.                                                                                                                                                                            | string   | ​                                                   | `"Mozilla/5.0 (Macintosh, Intel Mac OS X 10_15_7)...Safari/537.36"` |
| **meta (optional)**            | Any other parameter that needs to be sent.                                                                                                                                                                | object   | ​                                                   | ​                                                                   |

### **Sample JSON Request**

```
"payload": {
	"activity_type": "LOGIN_ACTIVITY",
	"source": "PRODUCT_CLOUD",        
	"environment": "PRODUCTION",
        "user_id": "https://www.linkedin.com/in/userid",
        "user_id_type":"LINKEDIN",
        "ip_addr": "156.59.87.83",
        "event_id": 1231231232,  
        "event_at": 639303296,  
        "product_id": "reoWebApp",
        "user_agent": "Mozilla/5.0 (Macintosh, Intel Mac OS X 10_15_7) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
        "meta": {"property1":"value1","property2":"value2"}
    }
```

### **Sample JSON Response \[Success]**

```json
{
    "response_code": "200",
    "response": "Data Uploaded",
    "status": "success"
}
```

### **Sample JSON Response \[Wrong API Key]**

```json
{
    "response_code": 400,
    "response": "Authentication Failure",
    "status": "failure"
}
```
