> ## 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.

# Update AdUnits

> 
Stores ad_unit information in the cache.
Used to update serving logic based on ad_unit metadata.




## OpenAPI

````yaml /openapi/decision.api.en-dev.json post /app/api/cache/ad-units
openapi: 3.1.0
info:
  contact:
    email: a2support@aiderx.io
    name: A2 Support
    url: https://aiderx.io
  description: >+

    ### Introduction

    The Decision API is responsible for selecting and distributing ads or
    content based on user requests or contextual information, all in real time.

    Its rapid response and dynamic capabilities enable the **optimal** ad or
    recommendation to be served, ensuring users receive the highest possible
    value.


    A variety of algorithms, machine learning models, and rule-based logic can
    be applied, allowing the system to **adapt flexibly** to constantly changing
    conditions.

  title: Decision APIs
  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: >

      Ad Serving APIs for requesting ads and configuring cache settings and
      other parameters of the ad serving modules.
    name: Ad Serving
  - description: |

      Recommendation Serving APIs for requesting recommendations.
    name: Recommendation Serving
  - description: >-

      APIs for manipulating caches of the serving server.


      ### **Important**

      If you directly manipulate the cached data related to advertising or
      recommendations on the Serving server,

      we **strongly advise** against also modifying the advertising or
      recommendation data through the Ad Manager.


      Alternatively, we **recommend** handling any advertising or recommendation
      data modifications via the Ad Manager APIs.

      Any changes made on the Serving server will **not** be reflected in the Ad
      Manager,

      which can compromise **data integrity**.
    name: Cache Management
  - description: |-

      APIs for manipulating configurations of the serving server
    name: Configuration
  - description: >

      APIs for receiving conversion, impression, and click logs related to ads
      or recommendations.
    name: Ad Log
paths:
  /app/api/cache/ad-units:
    post:
      tags:
        - Cache Management
      summary: Update AdUnits
      description: |

        Stores ad_unit information in the cache.
        Used to update serving logic based on ad_unit metadata.
      requestBody:
        content:
          application/json:
            schema:
              items:
                $ref: '#/components/schemas/AdUnit'
              type: array
        required: true
      responses:
        '204':
          description: Success
        '400':
          content:
            text/plain:
              schema:
                type: string
          description: Failed to parse the request body as JSON
        '415':
          content:
            text/plain:
              schema:
                type: string
          description: 'Expected request with `Content-Type: application/json`'
        '422':
          content:
            text/plain:
              schema:
                type: string
          description: Failed to deserialize the JSON body into the target type
        '500':
          description: Internal Server Error.
      security:
        - '': []
components:
  schemas:
    AdUnit:
      properties:
        ad_unit_sizes:
          description: |-
            Targeting metadata sizes
            Distinct from display/video.w/h which govern serving and rendering.
          items:
            $ref: '#/components/schemas/AdUnitSize'
          type:
            - array
            - 'null'
        code:
          description: Ad unit code identifier.
          type: string
        created_at:
          description: The date and time when the ad unit was created.
          format: date-time
          type: string
        created_by:
          description: The ID of the user who created the ad unit.
          format: uuid
          type: string
        description:
          description: Description of the ad unit.
          type:
            - string
            - 'null'
        display:
          allOf:
            - $ref: '#/components/schemas/DisplayPlacement'
          default:
            clktype: 1
            priv: 0
            unit: 2
          description: >-
            Placement Subtype Object that indicates that this may be a display
            placement and provides additional detail related thereto.
        ext:
          allOf:
            - $ref: '#/components/schemas/AdUnitExt'
          default:
            algorithm: axa0
            approval_method: admin
            bcat: []
            default_cpa: 0
            default_cpc: 0
            display:
              enabled: 1
            native:
              enabled: 0
              render_mode: html
            payout: rates
            recommendation:
              enabled: 0
            responsive: fixed
            target_ecpm: 0
            video:
              enabled: 0
          description: >-
            Additional ad unit-specific extensions. Defaults to the `AdUnitExt`
            object.
        gpid:
          description: Canonical Placement ID for OpenRTB imp.ext.gpid.
          type:
            - string
            - 'null'
        id:
          description: ID of the ad unit (uuid7)
          format: uuid
          type: string
        instl:
          allOf:
            - $ref: '#/components/schemas/Instl'
          default: 0
          description: >-
            Indicates if this is an interstitial placement, where 0 = no, 1 =
            yes.

            Applies across display, video, and native.
        is_active:
          description: Whether the ad unit is active.
          type:
            - boolean
            - 'null'
        name:
          description: Name of the ad unit.
          type: string
        native:
          allOf:
            - $ref: '#/components/schemas/NativePlacement'
          default:
            assets: []
          description: >-
            Based on OpenRTB Native Ads 1.2 Native Markup Request Object, not
            the AdCOM standard native format
        path:
          description: Hierarchical path of the ad unit (e.g., "parent_id/child_id").
          type: string
        recommendation:
          allOf:
            - $ref: '#/components/schemas/RecommendationPlacement'
          default:
            associated_item: {}
            ext: {}
            personalization: {}
            ptype: associated_item
            topn: 10
        video:
          allOf:
            - $ref: '#/components/schemas/VideoPlacement'
          default:
            boxing: 1
            maxext: 0
            podseq: 0
            skipafter: 0
            skipmin: 0
            slotinpod: 0
            unit: 2
          description: >-
            Placement Subtype Object that indicates that this may be a video
            placement and provides additional detail related thereto.
      required:
        - id
        - name
        - code
        - path
        - created_by
        - created_at
      type: object
    AdUnitSize:
      description: A targeting size entry for an ad unit
      properties:
        h:
          description: Height in pixels.
          format: uint32
          minimum: 0
          type: integer
        w:
          description: Width in pixels.
          format: uint32
          minimum: 0
          type: integer
      required:
        - w
        - h
      type: object
    DisplayPlacement:
      properties:
        ampren:
          format: uint8
          maximum: 255
          minimum: 0
          type:
            - integer
            - 'null'
        api:
          items:
            format: uint16
            maximum: 65535
            minimum: 0
            type: integer
          type:
            - array
            - 'null'
        clktype:
          default: 1
          format: uint8
          maximum: 255
          minimum: 0
          type: integer
        context:
          anyOf:
            - $ref: '#/components/schemas/DisplayContext'
            - type: 'null'
        ctype:
          items:
            format: uint8
            maximum: 255
            minimum: 0
            type: integer
          type:
            - array
            - 'null'
        displayfmt:
          anyOf:
            - $ref: '#/components/schemas/DisplayFormat'
            - type: 'null'
        event:
          items:
            $ref: '#/components/schemas/EventSpec'
          type:
            - array
            - 'null'
        ext: true
        h:
          format: float
          type:
            - number
            - 'null'
        ifrbust:
          items:
            type: string
          type:
            - array
            - 'null'
        mime:
          items:
            type: string
          type:
            - array
            - 'null'
        pos:
          anyOf:
            - $ref: '#/components/schemas/PlacementPosition'
            - type: 'null'
        priv:
          default: 0
          format: uint8
          maximum: 255
          minimum: 0
          type: integer
        ptype:
          anyOf:
            - $ref: '#/components/schemas/DisplayPlacementTypes'
            - type: 'null'
        topframe:
          format: uint8
          maximum: 255
          minimum: 0
          type:
            - integer
            - 'null'
        unit:
          default: 2
          format: uint8
          maximum: 255
          minimum: 0
          type: integer
        w:
          format: float
          type:
            - number
            - 'null'
      type: object
    AdUnitExt:
      properties:
        algorithm:
          default: axa0
          description: Algorithm used for the ad unit.
          type: string
        approval_method:
          allOf:
            - $ref: '#/components/schemas/AdUnitApproval'
          default: admin
          description: Approval method for the ad unit.
        bcat:
          default: []
          description: >-
            Blocked advertiser categories using the IAB taxonomy, and extended
            with additional sensitive categories.
          items:
            type: string
          type:
            - array
            - 'null'
        default_cpa:
          default: 0
          description: >-
            Default CPA, for CPA line item that has no specific target CPA.
            Defaults to 0.0.
          format: double
          type: number
        default_cpc:
          default: 0
          description: >-
            Default CPC, for CPC line item that has no specific target CPC.
            Defaults to 0.0.
          format: double
          type: number
        display:
          default:
            enabled: 0
          description: Display-specific extension data in JSON format.
        external_raw_data:
          description: External raw data for the ad unit, represented as a map.
        implicit_app_inference:
          anyOf:
            - $ref: '#/components/schemas/ImplicitAppInference'
            - type: 'null'
          description: >-
            Configuration for fallback/implicit mobile app inference via UA
            keyword mapping.
        native:
          allOf:
            - $ref: '#/components/schemas/AdUnitExtNative'
          default:
            enabled: 0
            render_mode: html
          description: Native-specific extension data.
        passback:
          description: Passback ad tags for the ad unit, represented as a map.
        payout:
          allOf:
            - $ref: '#/components/schemas/AdUnitPayout'
          default: rates
          description: Payout type for the ad unit.
        public_url:
          description: |-
            Public URL override for this ad unit's event tracker URLs.
            If set, overrides EdgeConfig.public_url for this ad unit.
          type:
            - string
            - 'null'
        publisher:
          description: publisher information for the ad unit.
        recommendation:
          default:
            enabled: 0
          description: Recommendation-specific extension data in JSON format.
        responsive:
          allOf:
            - $ref: '#/components/schemas/AdUnitResponsiveness'
          default: fixed
          description: Indicates whether the ad unit is responsive.
        target_ecpm:
          default: 0
          description: >-
            Target eCPM (effective cost per mille) for the ad unit. Defaults to
            0.0.
          format: double
          type: number
        target_service:
          description: Target service for the ad unit.
          type:
            - string
            - 'null'
        video:
          default:
            enabled: 0
          description: Video-specific extension data in JSON format.
      type: object
    Instl:
      description: OpenRTB interstitial flag.
      enum:
        - 0
        - 1
      type: integer
      x-enum-varnames:
        - 'No'
        - 'Yes'
    NativePlacement:
      description: >-
        Based on OpenRTB Native Ads 1.2 Native Markup Request Object, not the
        AdCOM standard native format
      properties:
        assets:
          default: []
          description: Native asset request definitions for this placement.
          items:
            $ref: '#/components/schemas/AssetRequest'
          type: array
        context:
          description: >-
            OpenRTB Native context type (1=ContentCentric, 2=SocialCentric,
            3=ProductContext)
          format: uint16
          maximum: 65535
          minimum: 0
          type:
            - integer
            - 'null'
        contextsubtype:
          description: OpenRTB Native context subtype (e.g. 14=PrimarilyImageContent)
          format: uint16
          maximum: 65535
          minimum: 0
          type:
            - integer
            - 'null'
        ext:
          description: Optional vendor-specific extensions.
        plcmtcnt:
          description: OpenRTB Native placement count
          format: uint8
          maximum: 255
          minimum: 1
          type:
            - integer
            - 'null'
        plcmttype:
          description: >-
            OpenRTB Native placement type (1=Feed, 2=AtomicUnit,
            3=OutsideOfContent, 4=RecommendationWidget)
          format: uint16
          maximum: 65535
          minimum: 0
          type:
            - integer
            - 'null'
      type: object
    RecommendationPlacement:
      properties:
        associated_item:
          default: {}
          description: Associated item extension data in JSON format.
        candidate_filtering:
          anyOf:
            - $ref: '#/components/schemas/CandidateFiltering'
            - type: 'null'
          description: Candidate filtering.
        content_filter_rule:
          anyOf:
            - $ref: '#/components/schemas/Expr'
            - type: 'null'
          description: Content filter rule.
        ext:
          default: {}
          description: Additional ad unit-specific extensions.
        personalization:
          default: {}
          description: Personalization extension data in JSON format.
        ptype:
          allOf:
            - $ref: '#/components/schemas/AdUnitSubtypeRecommendation'
          default: associated_item
          description: Ad unit subtype.
        topn:
          default: 10
          description: Number of items to recommend.
          format: uint32
          maximum: 99
          minimum: 0
          type: integer
      type: object
    VideoPlacement:
      properties:
        api:
          items:
            format: uint16
            maximum: 65535
            minimum: 0
            type: integer
          type:
            - array
            - 'null'
        boxing:
          default: 1
          format: uint8
          maximum: 255
          minimum: 0
          type:
            - integer
            - 'null'
        clktype:
          format: uint8
          maximum: 255
          minimum: 0
          type:
            - integer
            - 'null'
        comp:
          items:
            $ref: '#/components/schemas/Companion'
          type:
            - array
            - 'null'
        comptype:
          items:
            $ref: '#/components/schemas/CompanionType'
          type:
            - array
            - 'null'
        ctype:
          items:
            format: uint32
            minimum: 0
            type: integer
          type:
            - array
            - 'null'
        delay:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        delivery:
          items:
            $ref: '#/components/schemas/DeliveryMethod'
          type:
            - array
            - 'null'
        expdir:
          items:
            $ref: '#/components/schemas/ExpandableDirection'
          type:
            - array
            - 'null'
        ext: true
        h:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        linear:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        maxbitr:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        maxdur:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        maxext:
          default: 0
          format: int32
          type:
            - integer
            - 'null'
        maxseq:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        mime:
          items:
            type: string
          type:
            - array
            - 'null'
        minbitr:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        mincpmpersec:
          format: double
          type:
            - number
            - 'null'
        mindur:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        overlayexpdir:
          items:
            $ref: '#/components/schemas/ExpandableDirection'
          type:
            - array
            - 'null'
        playend:
          anyOf:
            - $ref: '#/components/schemas/PlaybackCessationMode'
            - type: 'null'
        playmethod:
          items:
            format: uint8
            maximum: 255
            minimum: 0
            type: integer
          type:
            - array
            - 'null'
        poddur:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        podid:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        podseq:
          default: 0
          format: int8
          maximum: 127
          minimum: -128
          type:
            - integer
            - 'null'
        pos:
          anyOf:
            - $ref: '#/components/schemas/PlacementPosition'
            - type: 'null'
        ptype:
          format: uint8
          maximum: 255
          minimum: 0
          type:
            - integer
            - 'null'
        rqddurs:
          items:
            format: uint32
            minimum: 0
            type: integer
          type:
            - array
            - 'null'
        skip:
          format: uint8
          maximum: 255
          minimum: 0
          type:
            - integer
            - 'null'
        skipafter:
          default: 0
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        skipmin:
          default: 0
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        slotinpod:
          default: 0
          format: int8
          maximum: 127
          minimum: -128
          type:
            - integer
            - 'null'
        unit:
          default: 2
          format: uint8
          maximum: 255
          minimum: 0
          type:
            - integer
            - 'null'
        w:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
      type: object
    DisplayContext:
      enum:
        - ContentCentric
        - ArticleContent
        - VideoContent
        - AudioContent
        - ImageContent
        - UserGeneratedContent
        - SocialCentric
        - EmailContent
        - ChatContent
        - ProductContext
        - AppStore
        - ProductReviews
      type: string
    DisplayFormat:
      properties:
        expdir:
          anyOf:
            - $ref: '#/components/schemas/ExpandableDirection'
            - type: 'null'
        ext: true
        h:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        hratio:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        w:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        wratio:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
      type: object
    EventSpec:
      properties:
        api:
          items:
            format: uint16
            maximum: 65535
            minimum: 0
            type: integer
          type:
            - array
            - 'null'
        ext: true
        jstrk:
          items:
            type: string
          type:
            - array
            - 'null'
        method:
          items:
            $ref: '#/components/schemas/EventTrackingMethod'
          type:
            - array
            - 'null'
        pxtrk:
          items:
            type: string
          type:
            - array
            - 'null'
        type:
          $ref: '#/components/schemas/EventType'
        wjs:
          default: 1
          format: int32
          type: integer
        wpx:
          default: 1
          format: int32
          type: integer
      required:
        - type
      type: object
    PlacementPosition:
      enum:
        - Unknown
        - AboveTheFold
        - Locked
        - BelowTheFold
        - Header
        - Footer
        - Sidebar
        - FullScreen
      type: string
    DisplayPlacementTypes:
      enum:
        - Feed
        - AtomicUnit
        - OutsideCore
        - RecommendationWidget
      type: string
    AdUnitApproval:
      enum:
        - admin
        - delegate
      type: string
    ImplicitAppInference:
      properties:
        android_bundle:
          type:
            - string
            - 'null'
        app_name:
          type:
            - string
            - 'null'
        cat:
          items:
            type: string
          type:
            - array
            - 'null'
        ios_bundle:
          type:
            - string
            - 'null'
        ua_keywords:
          default: []
          items:
            type: string
          type: array
      type: object
    AdUnitExtNative:
      properties:
        enabled:
          default: 0
          description: Whether native ads are enabled for the ad unit (0 or 1).
          format: int64
          type: integer
        render_mode:
          allOf:
            - $ref: '#/components/schemas/NativeRenderMode'
          default: html
          description: Native rendering mode for this ad unit.
      type: object
    AdUnitPayout:
      enum:
        - rates
        - revenue_share
        - none
      type: string
    AdUnitResponsiveness:
      enum:
        - fixed
        - resized
      type: string
    AssetRequest:
      anyOf:
        - required:
            - title
        - required:
            - img
        - required:
            - video
        - required:
            - data
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/DataAssetRequest'
            - type: 'null'
        ext: true
        id:
          format: int32
          type: integer
        img:
          anyOf:
            - $ref: '#/components/schemas/ImageAssetRequest'
            - type: 'null'
        required:
          anyOf:
            - $ref: '#/components/schemas/IsRequired2'
            - type: 'null'
        title:
          anyOf:
            - $ref: '#/components/schemas/TitleAssetRequest'
            - type: 'null'
        video:
          anyOf:
            - $ref: '#/components/schemas/VideoAssetRequest'
            - type: 'null'
      required:
        - id
      type: object
    CandidateFiltering:
      properties:
        method:
          allOf:
            - $ref: '#/components/schemas/CandidateFilteringMethod'
          default: NoFilter
          description: Filtering method.
      type: object
    Expr:
      oneOf:
        - properties:
            data:
              $ref: '#/components/schemas/Compare'
            type:
              const: cmp
              type: string
          required:
            - type
            - data
          type: object
        - properties:
            data:
              items:
                $ref: '#/components/schemas/Expr'
              type: array
            type:
              const: and
              type: string
          required:
            - type
            - data
          type: object
        - properties:
            data:
              items:
                $ref: '#/components/schemas/Expr'
              type: array
            type:
              const: or
              type: string
          required:
            - type
            - data
          type: object
        - properties:
            data:
              $ref: '#/components/schemas/Expr'
            type:
              const: not
              type: string
          required:
            - type
            - data
          type: object
    AdUnitSubtypeRecommendation:
      oneOf:
        - const: associated_item
          description: Associated item ad unit subtype.
          type: string
        - const: personalization
          description: Personalization ad unit subtype.
          type: string
    Companion:
      properties:
        display:
          anyOf:
            - $ref: '#/components/schemas/DisplayPlacement'
            - type: 'null'
        ext: true
        id:
          type:
            - string
            - 'null'
        vcm:
          format: int32
          type:
            - integer
            - 'null'
      type: object
    CompanionType:
      enum:
        - Static
        - HTML
        - IFrame
      type: string
    DeliveryMethod:
      enum:
        - Streaming
        - Progressive
        - Download
      type: string
    ExpandableDirection:
      enum:
        - Left
        - Right
        - Up
        - Down
        - FullScreen
        - ResizeMinimize
      type: string
    PlaybackCessationMode:
      enum:
        - OnVideoCompletion
        - OnLeavingViewport
        - OnLeavingViewportContinuesAsAUnit
      type: string
    EventTrackingMethod:
      enum:
        - 1
        - 2
      type: integer
    EventType:
      enum:
        - 1
        - 2
        - 3
        - 4
        - 5
      type: integer
    NativeRenderMode:
      description: >-
        Native rendering mode: server-rendered HTML markup, or raw asset data
        for client-side rendering.
      enum:
        - html
        - asset
      type: string
    DataAssetRequest:
      properties:
        ext: true
        len:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        type:
          format: uint16
          maximum: 65535
          minimum: 0
          type: integer
      required:
        - type
      type: object
    ImageAssetRequest:
      properties:
        ext: true
        h:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        hmin:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        mimes:
          items:
            type: string
          type:
            - array
            - 'null'
        type:
          format: uint16
          maximum: 65535
          minimum: 0
          type:
            - integer
            - 'null'
        w:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
        wmin:
          format: uint32
          minimum: 0
          type:
            - integer
            - 'null'
      type: object
    IsRequired2:
      enum:
        - 0
        - 1
      type: integer
      x-enum-varnames:
        - 'No'
        - 'Yes'
    TitleAssetRequest:
      properties:
        ext: true
        len:
          format: uint32
          minimum: 0
          type: integer
      required:
        - len
      type: object
    VideoAssetRequest:
      properties:
        ext: true
        linearity:
          anyOf:
            - $ref: '#/components/schemas/LinearityMode'
            - type: 'null'
        maxduration:
          format: uint32
          minimum: 0
          type: integer
        mimes:
          items:
            type: string
          type: array
        minduration:
          format: uint32
          minimum: 0
          type: integer
        protocols:
          items:
            format: uint16
            maximum: 65535
            minimum: 0
            type: integer
          type: array
      required:
        - mimes
        - minduration
        - maxduration
        - protocols
      type: object
    CandidateFilteringMethod:
      enum:
        - NoFilter
        - ViewPenalty
        - ViewOut
      type: string
    Compare:
      properties:
        lhs:
          items:
            type: string
          type: array
        op:
          $ref: '#/components/schemas/Op'
        rhs: true
      required:
        - lhs
        - op
        - rhs
      type: object
    LinearityMode:
      enum:
        - 1
        - 2
      type: integer
      x-enum-varnames:
        - Linear
        - NonLinear
    Op:
      enum:
        - eq
        - ne
        - lt
        - le
        - gt
        - ge
        - in
        - nin
      type: string

````