> For the complete documentation index, see [llms.txt](https://docs.dfinery.ai/api-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dfinery.ai/api-guide/api/export-api/export/post-event.md).

# POST: 이벤트 추출

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

적재되어있는 이벤트를 추출할 수 있는 API 입니다.

{% hint style="warning" %}
이벤트 데이터 추출은 현재 날짜로부터 365일 이전 데이터까지만 가능합니다.

이벤트 데이터 추출 기간은 최대 31일입니다.
{% endhint %}

## **쿼리 파라미터** <a href="#query-parameters" id="query-parameters"></a>

<table><thead><tr><th width="210">이름</th><th>필수값 여부<select><option value="xBw0HvmJduZN" label="선택" color="blue"></option><option value="VBuJ6ubzjfbi" label="필수" color="blue"></option></select></th><th>타입</th><th>설명</th></tr></thead><tbody><tr><td><code>service_id</code></td><td><span data-option="VBuJ6ubzjfbi">필수</span></td><td>String</td><td>서비스 ID</td></tr></tbody></table>

## **헤더** <a href="#headers" id="headers"></a>

<table><thead><tr><th>필드명</th><th>필수값 여부<select><option value="3Gw9yCGdnldk" label="필수" color="blue"></option><option value="mVPQehiUZOei" label="선택" color="blue"></option></select></th><th>타입</th><th>값</th><th>설명</th></tr></thead><tbody><tr><td><code>Content-Type</code></td><td><span data-option="3Gw9yCGdnldk">필수</span></td><td>String</td><td><code>application/json</code></td><td>-</td></tr><tr><td><code>Authorization</code></td><td><span data-option="3Gw9yCGdnldk">필수</span></td><td>String</td><td><code>Bearer your-auth-token</code></td><td>API 인증 토큰</td></tr></tbody></table>

## **요청 본문** <a href="#request-body" id="request-body"></a>

<table><thead><tr><th>필드명</th><th>필수값 여부<select><option value="xBw0HvmJduZN" label="선택" color="blue"></option><option value="VBuJ6ubzjfbi" label="필수" color="blue"></option></select></th><th>타입</th><th>설명</th></tr></thead><tbody><tr><td><code>events</code></td><td><span data-option="xBw0HvmJduZN">선택</span></td><td>List of String</td><td>필터링 대상 이벤트명 리스트, 값이 존재하지 않을 경우 모든 이벤트 추출</td></tr><tr><td><code>events_condition_type</code></td><td><span data-option="VBuJ6ubzjfbi">필수</span></td><td>String</td><td><p>필터링 연산자, 아래 값을 지원합니다.</p><p><code>all</code> : 전체 이벤트,</p><p><code>include</code> : <code>events</code>의 이벤트만 포함,</p><p><code>exclude</code> : <code>events</code>의 이벤트 제외</p></td></tr><tr><td><code>properties</code></td><td><span data-option="xBw0HvmJduZN">선택</span></td><td>List of String</td><td>필터링 대상 이벤트 속성 리스트, 값이 존재하지 않을 경우 모든 이벤트 속성 추출</td></tr><tr><td><code>properties_condition_type</code></td><td><span data-option="xBw0HvmJduZN">선택</span></td><td>String</td><td><p>필터링 연산자, 아래 값을 지원합니다.</p><p>값이 존재하지 않을 경우 : 전체 이벤트 속성,</p><p><code>all</code> : 전체 이벤트 속성,</p><p><code>include</code> : <code>properties</code>의 이벤트 속성만 포함,</p><p><code>exclude</code> : <code>properties</code>의 이벤트 속성 제외</p></td></tr><tr><td><code>from_date</code></td><td><span data-option="VBuJ6ubzjfbi">필수</span></td><td>Date</td><td>이벤트 조회 시작일(<code>yyyy-MM-dd),</code><br>추출기간은 다음과 같습니다. <code>from_date</code>의 00시 00분 &#x3C;= 추출기간 &#x3C; <code>to_date</code> 의 00시 00분</td></tr><tr><td><code>to_date</code></td><td><span data-option="xBw0HvmJduZN">선택</span></td><td>Date</td><td>이벤트 조회 종료일(<code>yyyy-MM-dd),</code>추출기간은 다음과 같습니다. <code>from_date</code>의 00시 00분 &#x3C;= 추출기간 &#x3C; <code>to_date</code> 의 00시 00분, <code>to_date</code> 를 입력하지 않을 시 <code>to_date</code>는 현재 시간이 됩니다.</td></tr></tbody></table>

## **응답** <a href="#response" id="response"></a>

이벤트 추출의 응답은 `,` 로 구분되는 헤더가 포함된 csv 포맷입니다. 첫번째 줄이 헤더이고, 두번째 줄부터 추출된 데이터입니다. 아래의 표는 주요 헤더에 대한 설명입니다.

통합ID와 시스템 이벤트 속성의 경우 `properties`, `properties_condition_type` 에 상관없이 응답에 항상 포함됩니다.

값이 존재하지 않을 경우 기본값은 빈 값(empty) 입니다.

이벤트 속성에 대한 자세한 내용은 [이벤트 택소노미 설계하기](https://github.com/IGAWorksDev/dfn-v2-developer-reference-gitbook/blob/main/user_guide/ko/begin-to-use-dfinery/event-and-property/taxonomy.md) 를 참고하시면 됩니다.

| 필드명                                   | 구분             | 설명                                                                                                    |
| ------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------- |
| `df_unified_id`                       | 통합ID           | 통합ID                                                                                                  |
| `${your-standard-event-property-key}` | 표준 이벤트 속성      | 표준 이벤트 속성, Datetime 타입의 경우 서비스 타임존 기준                                                                 |
| `${your-custom-event-property-key}`   | 커스텀 이벤트 속성     | 커스텀 이벤트 속성, Datetime 타입의 경우 서비스 타임존 기준                                                                |
| `${your-df-item-property-key}`        | 표준, 커스텀 이벤트 속성 | 이벤트 아이템 (표준, 커스텀) 속성, Datetime 타입의 경우 서비스 타임존 기준                                                      |
| `df_api_version`                      | 시스템 이벤트 속성     | 이벤트 API 버전                                                                                            |
| `event_name`                          | 시스템 이벤트 속성     | 이벤트명                                                                                                  |
| `df_server_datetime`                  | 시스템 이벤트 속성     | 이벤트 로그 서버 도달 시각, 서비스 타임존 기준                                                                           |
| `df_correction_datetime`              | 시스템 이벤트 속성     | 이벤트 발생 시각, 서비스 타임존 기준                                                                                 |
| `df_event_detail_log_id`              | 시스템 이벤트 속성     | <p>이벤트 로그 ID, 구매 이벤트에서 여러 아이템이 포함되어 있는 경우,</p><p><code>${df\_event\_log\_id}:${n}</code> 의 형태입니다.</p> |
| `df_event_log_id`                     | 시스템 이벤트 속성     | 이벤트 로그 ID                                                                                             |

## 요청 예시 <a href="#request-example" id="request-example"></a>

```sh
curl -L \
  -X POST \
  -H 'Authorization: Bearer ${your-export-api-token}' \
  -H 'Content-Type: application/json' \
  'https://openapi.dfinery.ai/api/v1/export/event?service_id=${your-service-id}' \
  -d '{
    "events": ["df_purchase"],
    "events_condition_type": "include",
    "properties": ["df_discount", "df_items_df_price"],
    "properties_condition_type": "include",
    "from_date": "2024-08-25",
    "to_date": "2024-08-26"
}' -o results.csv
```

## 응답 예시 <a href="#response-example" id="response-example"></a>

### 성공 응답 <a href="#success-response" id="success-response"></a>

<pre><code><strong>200 OK
</strong>
<strong>custom_012,custom_event_p_boolean,custom_event_p_datetime,custom_event_p_double,custom_event_p_double_list,custom_event_p_long,custom_event_p_long_list,custom_event_p_string_list,df_api_version,df_correction_datetime,df_delivery_charge,df_discount,df_event_datetime,df_event_detail_log_id,df_event_log_id,df_event_name,df_items_custom_012391239128,df_items_custom_item_boolean,df_items_custom_item_datetime,df_items_custom_item_double,df_items_custom_item_double_list,df_items_custom_item_long,df_items_custom_item_long_list,df_items_custom_item_string,df_items_custom_item_string_list,df_items_df_category1,df_items_df_category2,df_items_df_category3,df_items_df_category4,df_items_df_category5,df_items_df_discount,df_items_df_item_id,df_items_df_item_name,df_items_df_price,df_items_df_quantity,df_keyword,df_order_id,df_payment_method,df_server_datetime,df_service_id,df_sharing_channel,df_sign_channel,df_source_type,df_total_purchase_amount,df_total_refund_amount,df_unified_id,sum
</strong>,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:35,,,2025.1.6 10:35,1736127307268:1736127306623:cd20207c-bb2a-4abf-a4a9-80804334cf15,1736127307268:1736127306623:cd20207c-bb2a-4abf-a4a9-80804334cf15,df_end_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:35,xyroon,,,SDK,,,7jPY23Q,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:35,,,2025.1.6 10:35,1736127307268:1736127306638:19c95a76-868b-49bc-a8a5-68058377342f,1736127307268:1736127306638:19c95a76-868b-49bc-a8a5-68058377342f,df_start_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:35,xyroon,,,SDK,,,7jPY23Q,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:38,,,2025.1.6 10:38,1736127490036:30873a05-62d3-4007-b643-f500a151be24,1736127490036:30873a05-62d3-4007-b643-f500a151be24,df_start_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025-01-06 10:38:10.036,xyroon,,,SDK,,,vft57Yw,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:38,,,2025.1.6 10:38,1736127513890:1d302d2c-e66e-4e7b-ba1d-94299a18c218,1736127513890:1d302d2c-e66e-4e7b-ba1d-94299a18c218,df_start_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:38,xyroon,,,SDK,,,vft57Yw,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:38,,,2025.1.6 10:38,1736127521375:0ae48e8f-05f5-48aa-acdd-0ce9c1d62631,1736127521375:0ae48e8f-05f5-48aa-acdd-0ce9c1d62631,df_sign_up,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:38,xyroon,,Kakao,SDK,,,vft57Yw,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:38,,,2025.1.6 10:38,1736127534688:10ce7ebd-ac54-4bbd-bd75-1e15c3ff92b6,1736127534688:10ce7ebd-ac54-4bbd-bd75-1e15c3ff92b6,df_start_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:38,xyroon,,,SDK,,,vft57Yw,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:47,,,2025.1.6 10:47,1736128036788:e90f4559-666c-4b04-9f1b-846c55f3b12d,1736128036788:e90f4559-666c-4b04-9f1b-846c55f3b12d,df_start_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:47,xyroon,,,SDK,,,vft57Yw,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:47,,,2025.1.6 10:47,1736128047673:c62a93ed-4979-4307-b2d5-cbcc3f46578e,1736128047673:c62a93ed-4979-4307-b2d5-cbcc3f46578e,df_start_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:47,xyroon,,,SDK,,,vft57Yw,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:47,,,2025.1.6 10:47,1736128055767:95d77aa8-0bf2-4967-908b-0ac60987e250,1736128055767:95d77aa8-0bf2-4967-908b-0ac60987e250,df_start_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:47,xyroon,,,SDK,,,vft57Yw,
,FALSE,,,null,,null,null,1.0.0,2025.1.6 10:47,,,2025.1.6 10:47,1736128058570:a68f6530-6496-48c1-b6bb-4593d03b140f,1736128058570:a68f6530-6496-48c1-b6bb-4593d03b140f,df_start_session,,FALSE,,,null,,null,,null,,,,,,,,,,,,,,2025.1.6 10:47,xyroon,,,SDK,,,vft57Yw,
</code></pre>

### 실패 응답 <a href="#error-response" id="error-response"></a>

자세한 내용은 [상세 응답](/api-guide/api/export-api/response.md) 참고하시면 됩니다.
