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

# 추천 제공

> 광고 유닛(`tagid`)과 요청 페이로드(`RecoRequest`)를 기반으로 추천 아이템을 제공합니다.
광고 유닛의 추천 정책을 확인하고 설정된 소스에서 후보를 조회합니다.
`seed_item_id`가 제공되면 Association 및 Pinned와 같이 시드 기반 조회를 지원하는 정책 소스에서 사용합니다.
렌더링할 아이템(`catalog_id`, `position`)과 추천 추적용 `tracking_token`을 반환합니다.



## OpenAPI

````yaml /openapi/decision.api.ko-dev.json post /app/v0/recommendation/{tagid}
openapi: 3.1.0
info:
  contact:
    email: a2support@aiderx.io
    name: A2 Support
    url: https://aiderx.io
  description: |-
    ### 소개
    Decision API는 사용자 요청 또는 컨텍스트 정보를 바탕으로 광고나 콘텐츠를 실시간으로 선택하고 배포합니다.
    빠른 응답과 동적 기능을 통해 최적의 광고 또는 추천을 제공하여 사용자가 가능한 가장 높은 가치를 얻도록 합니다.

    다양한 알고리즘, 머신러닝 모델 및 규칙 기반 로직을 적용할 수 있어 시스템이 끊임없이 변하는 조건에 유연하게 적응할 수 있습니다.
  title: Decision API
  version: dev
  x-logo:
    altText: A2 Logo
    url: >-
      https://cdn.prod.website-files.com/668de9e1f25ab5675d87758d/6690cf1bdce95af5e3522c25_a2_logo_800_250.png
servers: []
security: []
tags:
  - description: 광고 요청, 캐시 설정 및 광고 제공 모듈의 기타 매개변수를 구성하기 위한 API입니다.
    name: Ad Serving
  - description: 추천 요청을 위한 API
    name: Recommendation Serving
  - description: >-
      광고 제공 서버의 캐시를 조작하기 위한 API입니다.


      ### **중요**

      Serving 서버의 광고 또는 추천 관련 캐시 데이터를 직접 조작하는 경우 Ad Manager에서 광고 또는 추천 데이터를 함께
      수정하지 않는 것을 **강력히 권장합니다.**


      대신 모든 광고 또는 추천 데이터 변경은 Ad Manager API를 통해 처리하는 것을 **권장합니다.**

      Serving 서버에서 변경한 내용은 Ad Manager에 반영되지 않으므로 **데이터 무결성**이 손상될 수 있습니다.
    name: Cache Management
  - description: 광고 서빙 서버 설정 API
    name: Configuration
  - description: 광고 또는 추천과 관련된 전환, 노출 및 클릭 로그를 수신하는 API입니다.
    name: Ad Log
paths:
  /app/v0/recommendation/{tagid}:
    post:
      tags:
        - Recommendation Serving
      summary: 추천 제공
      description: >-
        광고 유닛(`tagid`)과 요청 페이로드(`RecoRequest`)를 기반으로 추천 아이템을 제공합니다.

        광고 유닛의 추천 정책을 확인하고 설정된 소스에서 후보를 조회합니다.

        `seed_item_id`가 제공되면 Association 및 Pinned와 같이 시드 기반 조회를 지원하는 정책 소스에서
        사용합니다.

        렌더링할 아이템(`catalog_id`, `position`)과 추천 추적용 `tracking_token`을 반환합니다.
      parameters:
        - description: 광고 유닛의 ID입니다. 광고 관리자에서 확인할 수 있습니다.
          in: path
          name: tagid
          required: true
          schema:
            description: 광고 유닛의 ID입니다. 광고 관리자에서 확인할 수 있습니다.
            format: uuid
            type: string
          style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecoRequest'
        description: 추천 요청에 사용하는 RecoRequest입니다.
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                items:
                  - catalog_id: catalog-123
                    position: 0
                  - catalog_id: catalog-234
                    position: 1
                tracking_token: dXNlci0xMjN8ZjQ3YWMxMGJ8OWMzZTc3YTE
                version: 0.1.0
              schema:
                $ref: '#/components/schemas/RecoResponse'
          description: 추천 제공 성공
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecoResponse'
            text/plain; charset=utf-8:
              path: /docs/redoc
          description: >-
            잘못된 JSON 요청 본문은 `text/plain`으로 반환됩니다. 유효하지 않은 tagid는 오류 코드가 포함된
            `application/json` RecoResponse로 반환됩니다.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecoResponse'
          description: AdUnit을 찾을 수 없습니다. 응답에는 JSON 오류 코드가 포함됩니다.
        '415':
          content:
            text/plain:
              schema:
                type: string
          description: '`Content-Type: application/json`인 요청이 필요합니다.'
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecoResponse'
            text/plain; charset=utf-8:
              path: /docs/redoc
          description: >-
            JSON 구조 또는 타입 역직렬화 오류는 `text/plain`으로 반환됩니다. 추천 비활성화 또는 제공 정책 부재는 오류
            코드가 포함된 `application/json` RecoResponse로 반환됩니다.
      security:
        - '': []
components:
  schemas:
    RecoRequest:
      description: 추천 요청에 사용하는 RecoRequest입니다.
      properties:
        app:
          anyOf:
            - $ref: '#/components/schemas/ServingRequestApp'
            - type: 'null'
          description: 앱 객체입니다.
        device:
          anyOf:
            - $ref: '#/components/schemas/Device'
            - type: 'null'
          description: 디바이스 객체입니다.
          examples:
            - null
        filter: true
        seed_item_id:
          type:
            - string
            - 'null'
        site:
          anyOf:
            - $ref: '#/components/schemas/ServingRequestSite'
            - type: 'null'
          description: 사이트 객체입니다.
        user:
          anyOf:
            - $ref: '#/components/schemas/User'
            - type: 'null'
          description: 사용자 객체입니다.
          examples:
            - gender: M
              id: account-187acvbvz
              yob: 1988
      type: object
    RecoResponse:
      properties:
        errorcode:
          description: 오류 코드입니다.
          type:
            - string
            - 'null'
        ext:
          description: 선택적인 A2 전용 확장 정보입니다.
        items:
          description: 추천 아이템 목록입니다.
          items:
            $ref: '#/components/schemas/RecommendationItem'
          type: array
        tracking_token:
          description: |-
            이 추천 결과를 식별하는 토큰이며 추적 호출에서 되돌려 보냅니다.
            오류 응답에는 포함되지 않습니다.
          type:
            - string
            - 'null'
        user:
          anyOf:
            - $ref: '#/components/schemas/User'
            - type: 'null'
          description: 광고 요청에서 되돌려 받은 User 객체입니다.
        version:
          description: SDK API 버전입니다.
          type: string
      required:
        - version
        - items
      type: object
    ServingRequestApp:
      properties:
        bundle:
          type:
            - string
            - 'null'
        domain:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        storeurl:
          type:
            - string
            - 'null'
        ver:
          type:
            - string
            - 'null'
      type: object
    Device:
      properties:
        ext:
          description: 광고 시스템별 확장을 위한 예약 필드
        geo:
          anyOf:
            - $ref: '#/components/schemas/Geo'
            - type: 'null'
          description: 사용자의 현재 위치로 간주되는 기기의 위치 정보. Geo 객체로 정의됨.
        ip:
          description: 기기와 가장 가까운 IPv4 주소.
          type:
            - string
            - 'null'
        ua:
          description: >-
            브라우저의 User-Agent 문자열입니다. 브라우저의 원시 사용자 에이전트 문자열을 나타냅니다. 하위 호환성을 위해 최종
            사용자의 디바이스에서 사용할 수 있으면 대체 표현인 User-Agent Client-Hints로 `sua`를 채우더라도
            `ua`를 User-Agent 문자열로 채우는 것이 권장됩니다. 이 필드에는 추론하거나 근사한 사용자 에이전트를 사용하지
            않습니다. 클라이언트가 User-Agent Client Hints를 지원하고 `sua` 필드가 있으면 입찰자는 디바이스
            유형, 브라우저 유형 및 버전과 사용자 에이전트 정보에 의존하는 기타 목적을 감지할 때 `sua`를 사용하고 `ua`를
            무시하는 것이 권장됩니다. `ua`에는 동결되거나 축소된 사용자 에이전트 문자열이 포함될 수 있기 때문입니다.
          type:
            - string
            - 'null'
      type: object
    ServingRequestSite:
      properties:
        domain:
          type:
            - string
            - 'null'
        mobile:
          type:
            - boolean
            - 'null'
        name:
          type:
            - string
            - 'null'
        page:
          type:
            - string
            - 'null'
        ref:
          type:
            - string
            - 'null'
        search:
          type:
            - string
            - 'null'
      type: object
    User:
      properties:
        buyeruid:
          description: 익스체인지가 해당 바이어를 위해 매핑한 바이어별 사용자 ID
          type:
            - string
            - 'null'
        ext:
          description: OpenRTB의 익스체인지 전용 확장을 위한 필드
        gender:
          anyOf:
            - $ref: '#/components/schemas/Gender'
            - type: 'null'
          description: 성별. “M”은 남성, “F”는 여성, “O”는 기타로 알려진 경우를 나타냅니다. 값이 없으면 알 수 없음으로 간주됩니다.
        geo:
          anyOf:
            - $ref: '#/components/schemas/Geo'
            - type: 'null'
          description: Geo 객체(3.2.19절)로 정의된 사용자의 거주지 위치입니다. 현재 위치와는 다를 수 있습니다.
        id:
          description: 익스체인지별 사용자 ID
          type:
            - string
            - 'null'
        keywords:
          description: >-
            키워드, 관심사 또는 의도를 쉼표로 구분한 목록입니다. 'keywords'와 'kwarray' 중 하나만 사용할 수
            있습니다.
          type:
            - string
            - 'null'
        yob:
          deprecated: true
          description: 출생 연도 (4자리 정수)
          format: uint16
          maximum: 65535
          minimum: 0
          type:
            - integer
            - 'null'
      type: object
    RecommendationItem:
      description: '[`RecoResponse`]에 포함되는 추천 아이템 하나입니다.'
      properties:
        catalog_id:
          description: 추천 아이템 카탈로그 ID입니다.
          type: string
        position:
          description: |-
            추천 지면의 0부터 시작하는 슬롯 위치입니다.
            지면에 구분된 슬롯이 없으면 0으로 설정합니다.
          format: int32
          type: integer
        score:
          description: 후보 풀에서 전달된 아이템의 순위 산정 관련성 점수입니다.
          format: double
          type:
            - number
            - 'null'
      required:
        - catalog_id
        - position
      type: object
    Geo:
      properties:
        accuracy:
          format: int32
          type:
            - integer
            - 'null'
        city:
          type:
            - string
            - 'null'
        country:
          type:
            - string
            - 'null'
        ext: true
        ipservice:
          anyOf:
            - $ref: '#/components/schemas/IpLocationService'
            - type: 'null'
        lastfix:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        lat:
          format: float
          type:
            - number
            - 'null'
        lon:
          format: float
          type:
            - number
            - 'null'
        metro:
          type:
            - string
            - 'null'
        region:
          type:
            - string
            - 'null'
        regionfips104:
          type:
            - string
            - 'null'
        type:
          anyOf:
            - $ref: '#/components/schemas/LocationType'
            - type: 'null'
        utcoffset:
          format: int32
          type:
            - integer
            - 'null'
        zip:
          type:
            - string
            - 'null'
      type: object
    Gender:
      enum:
        - M
        - F
        - O
      type: string
    IpLocationService:
      enum:
        - 1
        - 2
        - 3
        - 4
      type: integer
    LocationType:
      enum:
        - 1
        - 2
        - 3
      type: integer

````