# 유저 및 이벤트 정보 전송

## 사전 작업 <a href="#pre-work" id="pre-work"></a>

서버에서 이벤트를 전송하기 전, 먼저 프로젝트에 유효한 토큰을 발급받아 주세요.

{% content-ref url="authentication" %}
[authentication](https://docs.marketap.io/t3ZS4WXNMj0HK27EtIMV/developer/open-api/authentication)
{% endcontent-ref %}

## 1. 개요

이벤트 및 유저 데이터를 전송할 수 있도록 제공하는 Open API입니다. 이벤트, 이벤트 속성, 유저에 대한 자세한 설명은 아래 문서에서 확인하세요.

{% content-ref url="../taxonomy/server" %}
[server](https://docs.marketap.io/t3ZS4WXNMj0HK27EtIMV/developer/taxonomy/server)
{% endcontent-ref %}

## 2. 인증

API를 사용하려면 서버에서 발급받은 API 키를 Authorization 헤더에 포함해야 합니다.

```
Authorization: Bearer {your_api_key}
```

또한, 모든 요청에는 프로젝트 ID가 필요합니다.

이를 쿼리 파라미터에 포함하여 전송합니다.

```
?project_id=your_project_id
```

## 3. Open API 명세서

* timestamp 값으로 이벤트가 발생한 시간을 명시하는 경우, [ISO 8601 ](https://ko.wikipedia.org/wiki/ISO_8601)표준에 맞게 전달해주세요.
  * 예) "2025-01-17T05:39:22Z", "2025-01-17T05:39:22+09:00"

{% hint style="danger" %}
Timestamp를 명시적으로 적는 경우, Timezone값에 유의하세요.
{% endhint %}

* bulk 요청 시, 한 번의 호출당 `profiles`와 `events` 각각 1,000개 이하로 요청해주세요.

## Update bulk user profiles

> Updates user profile information in bulk.

```json
{"openapi":"3.0.0","info":{"title":"Marketap API","version":"1.0.0"},"servers":[{"url":"https://event.marketap.io","description":"Production Server"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"UpdateBulkUserProfileReq":{"type":"object","required":["profiles"],"properties":{"profiles":{"type":"array","items":{"$ref":"#/components/schemas/BulkUserProfile"}}}},"BulkUserProfile":{"type":"object","required":["user_id","properties"],"properties":{"user_id":{"type":"string"},"properties":{"type":"object","additionalProperties":true}}},"IngestionResponse":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/v1/api/profile/user":{"post":{"summary":"Update bulk user profiles","description":"Updates user profile information in bulk.","parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string"},"description":"The ID of the project."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBulkUserProfileReq"}}}},"responses":{"202":{"description":"The request has been accepted for processing."},"400":{"description":"Invalid request parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestionResponse"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestionResponse"}}}}}}}}}
```

## Collect bulk user events

> Receives a list of events and processes them asynchronously.

```json
{"openapi":"3.0.0","info":{"title":"Marketap API","version":"1.0.0"},"servers":[{"url":"https://event.marketap.io","description":"Production Server"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"CreateBulkEventReq":{"type":"object","required":["events"],"properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/CreateEventReq"}}}},"CreateEventReq":{"type":"object","required":["user_id","event_name"],"properties":{"user_id":{"type":"string"},"event_name":{"type":"string"},"properties":{"type":"object","additionalProperties":true},"timestamp":{"type":"string","format":"date-time","nullable":true}}},"IngestionResponse":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/v1/api/events":{"post":{"summary":"Collect bulk user events","description":"Receives a list of events and processes them asynchronously.","parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string"},"description":"The ID of the project."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBulkEventReq"}}}},"responses":{"202":{"description":"The request has been accepted for processing."},"400":{"description":"Invalid request parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestionResponse"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestionResponse"}}}}}}}}}
```

## Request user profile deletion

> Creates an asynchronous deletion job for the specified user profile.

```json
{"openapi":"3.0.0","info":{"title":"Marketap API","version":"1.0.0"},"servers":[{"url":"https://event.marketap.io","description":"Production Server"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"DeleteUserProfileReq":{"type":"object","required":["user_id"],"properties":{"user_id":{"type":"string"}}},"IngestionResponse":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/v1/api/profile/user/deletion-job":{"post":{"summary":"Request user profile deletion","description":"Creates an asynchronous deletion job for the specified user profile.","parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string"},"description":"The ID of the project."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteUserProfileReq"}}}},"responses":{"202":{"description":"The request has been accepted for processing."},"400":{"description":"Invalid request parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestionResponse"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestionResponse"}}}}}}}}}
```

## Request bulk user profile deletion

> Triggers asynchronous deletion of multiple user profiles.

```json
{"openapi":"3.0.0","info":{"title":"Marketap User Profile API - Deletion Job","version":"1.0.0"},"servers":[{"url":"https://event.marketap.io","description":"Production Server"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"DeleteBulkUserProfileReq":{"type":"object","required":["user_ids"],"properties":{"user_ids":{"type":"array","minItems":1,"items":{"type":"string"}}}},"UserProfileResponse":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/v1/api/profile/user/deletion-job/bulk":{"post":{"summary":"Request bulk user profile deletion","description":"Triggers asynchronous deletion of multiple user profiles.","parameters":[{"name":"project_id","in":"query","required":true,"description":"Project ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteBulkUserProfileReq"}}}},"responses":{"202":{"description":"Bulk user profile deletion job accepted."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserProfileResponse"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserProfileResponse"}}}}}}}}}
```

## Update bulk device profiles

> Updates device profile information and user-device mapping in bulk.

```json
{"openapi":"3.0.0","info":{"title":"Marketap API","version":"1.0.0"},"servers":[{"url":"https://event.marketap.io","description":"Production Server"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"UpdateBulkDeviceProfileReq":{"type":"object","required":["profiles"],"properties":{"profiles":{"type":"array","items":{"$ref":"#/components/schemas/UpdateDeviceProfileReq"}}}},"UpdateDeviceProfileReq":{"type":"object","required":["device"],"properties":{"device":{"$ref":"#/components/schemas/ClientDevice"},"user_id":{"type":"string","nullable":true},"timestamp":{"type":"string","format":"date-time","nullable":true}}},"ClientDevice":{"type":"object","required":["token","platform"],"properties":{"token":{"type":"string","description":"Push token (FCM / APNS / Web Push endpoint)"},"platform":{"type":"string","description":"IOS / ANDROID / WEB","default":"unknown"},"opt_in":{"type":"boolean","description":"Device push marketing opt-in status","nullable":true}}},"IngestionResponse":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/v1/api/profile/user/device/bulk":{"post":{"summary":"Update bulk device profiles","description":"Updates device profile information and user-device mapping in bulk.","parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string"},"description":"The ID of the project."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBulkDeviceProfileReq"}}}},"responses":{"202":{"description":"The request has been accepted for processing."},"400":{"description":"Invalid request parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestionResponse"}}}},"401":{"description":"Unauthorized request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestionResponse"}}}}}}}}}
```
