# POST: Loading an event

<mark style="color:green;">`POST`</mark> `/api/v1/events`

You can load one or more events at once via the event loading API. The events you want to load must have been registered in advance in the console.

You can **load up to 100 events** in one request. Also, you can **load up to 100 event items in one request.**

{% hint style="warning" %}
If you need to load many events, it is better to collect multiple events and call the event loading API at once rather than calling the event loading API individually, in terms of speed and request limits. [Request limits](https://docs.dfinery.ai/api-guide/rate-limit) should always be considered when linking.
{% endhint %}

## **Query Parameters**

<table><thead><tr><th width="173">Name</th><th>Whether required<select><option value="xBw0HvmJduZN" label="Select" color="blue"></option><option value="VBuJ6ubzjfbi" label="Essential" color="blue"></option></select></th><th>Type</th><th>Explanation</th></tr></thead><tbody><tr><td><code>service_id</code></td><td><span data-option="VBuJ6ubzjfbi">Essential</span></td><td>String</td><td>Service ID</td></tr></tbody></table>

## **Header**

<table><thead><tr><th>Field name</th><th>Whether Required<select><option value="3Gw9yCGdnldk" label="Essential" color="blue"></option><option value="mVPQehiUZOei" label="Select" color="blue"></option></select></th><th>Type</th><th>Value</th><th>Explanation</th></tr></thead><tbody><tr><td><code>Content-Type</code></td><td><span data-option="3Gw9yCGdnldk">Essential</span></td><td>String</td><td><code>application/json</code></td><td>-</td></tr><tr><td><code>access_token</code></td><td><span data-option="3Gw9yCGdnldk">Essential</span></td><td>String</td><td><code>your-api-token-key</code></td><td>API Authentication Token</td></tr></tbody></table>

## **Request Body**

<table><thead><tr><th>Field Name</th><th>Whether Required<select><option value="xBw0HvmJduZN" label="Select" color="blue"></option><option value="VBuJ6ubzjfbi" label="Essential" color="blue"></option></select></th><th>Type</th><th>Explanation</th></tr></thead><tbody><tr><td><a href="#common"><code>common</code></a></td><td><span data-option="VBuJ6ubzjfbi">Essential</span></td><td>Object</td><td>Common properties for event loading</td></tr><tr><td><a href="#events"><code>events</code></a></td><td><span data-option="VBuJ6ubzjfbi">Essential</span></td><td>Array of Object</td><td>Event Information</td></tr></tbody></table>

### Common

<table><thead><tr><th>Field Name</th><th>Whether Required<select><option value="xBw0HvmJduZN" label="Select" color="blue"></option><option value="VBuJ6ubzjfbi" label="Essential" color="blue"></option></select></th><th>Type</th><th>Explanation</th></tr></thead><tbody><tr><td><a href="#identity"><code>identity</code></a></td><td><span data-option="VBuJ6ubzjfbi">Essential</span></td><td>Object</td><td>User identifier</td></tr></tbody></table>

### Identity

User identifier information. **You must enter a value in at least one of the fields below.**

<table><thead><tr><th>Field Name</th><th>Whether Required<select><option value="xBw0HvmJduZN" label="Select" color="blue"></option><option value="VBuJ6ubzjfbi" label="Essential" color="blue"></option></select></th><th>Type</th><th>Explanation</th></tr></thead><tbody><tr><td><code>external_id</code></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>String</td><td>External ID</td></tr><tr><td><code>phone_no</code></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>String</td><td>Phone Number</td></tr><tr><td><code>email</code></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>String</td><td>Email</td></tr><tr><td><code>kakao_user_id</code></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>String</td><td>Kakao ID</td></tr><tr><td><code>line_user_id</code></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>String</td><td>Line ID</td></tr></tbody></table>

### Events

This is the event information. The event you want to load must be pre-registered in the console. For more information about standard events and event properties, see [Designing Event Taxonomies in the User Guide.](https://github.com/IGAWorksDev/dfn-v2-developer-reference-gitbook/blob/main/user_guide/ko/begin-to-use-dfinery/event-and-property/taxonomy.md)

<table><thead><tr><th>Field Name</th><th>Whether required<select><option value="xBw0HvmJduZN" label="Select" color="blue"></option><option value="VBuJ6ubzjfbi" label="Essential" color="blue"></option></select></th><th>Type</th><th>Explanation</th></tr></thead><tbody><tr><td><code>event_log_id</code></td><td><span data-option="VBuJ6ubzjfbi">Essential</span></td><td>String</td><td>Event Identification ID, UUID Format,<br><code>xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx</code></td></tr><tr><td><code>event_name</code></td><td><span data-option="VBuJ6ubzjfbi">Essential</span></td><td>String</td><td>Event name</td></tr><tr><td><code>event_datetime</code></td><td><span data-option="VBuJ6ubzjfbi">Essential</span></td><td>Datetime</td><td>Event occurrence time</td></tr><tr><td><a href="#event_items"><code>event_items</code></a></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>Array of Object</td><td>Product Information</td></tr><tr><td><a href="#event_properties"><code>event_properties</code></a></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>Object</td><td>Event properties</td></tr></tbody></table>

### Event\_items

This is an event item attribute. **The field name should be the sub-attribute name of the item pre-registered in the console (`df_item`), and the value should be the value of the corresponding attribute.** Up to 100 event items can be loaded at a time.

<table><thead><tr><th>Field Name</th><th>Whether Required<select><option value="xBw0HvmJduZN" label="Select" color="blue"></option><option value="VBuJ6ubzjfbi" label="Essential" color="blue"></option></select></th><th>Type</th><th>Explanation</th></tr></thead><tbody><tr><td><code>${your-df-item-property-key}</code></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>String, Long, Double, Boolean, Datetime, Array</td><td>Pre-registered event item attribute information</td></tr></tbody></table>

### Event\_properties

This is an event attribute. **The field name must be the attribute name of an event attribute pre-registered in the console, excluding items ( `df_item`), and the value must be the value of the attribute.**

<table><thead><tr><th>Name</th><th>Whether required<select><option value="xBw0HvmJduZN" label="Select" color="blue"></option><option value="VBuJ6ubzjfbi" label="Essential" color="blue"></option></select></th><th>Type</th><th>Explanation</th></tr></thead><tbody><tr><td><code>${your-event-property-key}</code></td><td><span data-option="xBw0HvmJduZN">Select</span></td><td>String, Long, Double, Boolean, Datetime, Array</td><td>Pre-registered event attribute information</td></tr></tbody></table>

## Example request

```sh
curl -L \
  -X POST \
  -H 'access_token: ${your-import-api-token}' \
  -H 'Content-Type: application/json' \
  'https://openapi.dfinery.ai/api/v1/events?service_id=${your-service-id}' \
  -d '{
  "common": {
    "identity": {
      "external_id": "dfn-user-123",
      "email": "dfn@gmail.com"
    }
  },
  "events": [
    {
      "event_log_id": "b0c9cf18-f3c0-4879-bb2e-92c65858dabc",
      "event_name": "df_login",
      "event_datetime": "2024-06-24T06:01:48.501Z",
      "event_properties": null,
      "event_items": null
    },
    {
      "event_log_id": "464bc021-9c56-481e-8ee8-3bf06de7c418",
      "event_name": "df_purchase",
      "event_datetime": "2024-06-24T06:42:25.394Z",
      "event_properties": {
        "df_order_id": "dwtfmoe",
        "df_delivery_charge": 1000,
        "df_payment_method": "card",
        "df_total_purchase_amount": 4000
      },
      "event_items": [
        {
          "df_item_id": "1",
          "df_item_name": "item1",
          "df_price": 3000,
          "df_quantity": 1,
          "df_discount": 0
        }
      ]
    }
  ]
}'
```

## **Example response**

### Normal response

```json
Content-Type: application/json
access_token: ${your-api-token}
{
  "status": true,
  "code": "20000",
  "message": "OK",
  "data": true
}
```

#### Failure response <a href="#undefined-6" id="undefined-6"></a>

Please refer to [the detailed response](https://docs.dfinery.ai/api-guide/en/api/import-api/response) for more details .

**40402 TOO\_MANY\_EVENTS**

When the number of events exceeds 100 or the number of event items exceeds 100.

```json
Content-Type: application/json
access_token: ${your-api-token}
{
  "status": false,
  "code": "40402",
  "message": "TOO_MANY_EVENTS",
  "data": true
}
```
