> ## 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 a campaign

> Updates an existing advertising campaign and returns information about the updated campaign.

Access Control:
- Only the owner of the campaign can update it.

_If you change the campaign to archived, the budget allocated to the campaign is returned._



## OpenAPI

````yaml /openapi/adm.openapi.en-0.2.2.json patch /campaigns
openapi: 3.1.0
info:
  description: >
    ## Introduction

    The Data Management APIs comprehensively oversees the **diverse data** used
    by advertising and recommendation systems, ensuring that the Decision API
    runs accurately and efficiently.


    From registering, updating, and deleting campaigns and placements to **log
    and statistics analysis**, it provides the insights necessary for effective
    system operation.


    The resulting data and metrics are used by the Decision API to **optimize ad
    and content decisions**, ultimately boosting the overall performance of the
    advertising and recommendation system.
  title: Data Management APIs
  version: 0.1.3
servers: []
security: []
tags:
  - name: Audience Targeting
  - description: >

      The Audience Management APIs to seamlessly integrate Audience-related
      data.  


      References:

      - [First-Party
      Data](https://docs.aiderx.io/guides/about-a2/en/first-party-data)
    name: Audience
  - description: >
      APIs for collecting user activity data to enhance ad targeting and
      performance optimization.


      Activity Data captures actual user behavior data like product views,
      searches, cart additions, and purchases across all users, regardless of ad
      interactions.


      References:

      - [First-Party
      Data](https://docs.aiderx.io/guides/about-a2/en/first-party-data)
    name: Activity Log
  - description: >

      The Audience Attribute API provides access to audience attribute data.


      References:

      - [Audience
      Targeting](https://docs.aiderx.io/guides/about-a2/en/audience-targeting)
    name: Audience Attribute
  - description: >

      The Audience Segment API provides access to audience segment data.


      References:

      - [Audience
      Targeting](https://docs.aiderx.io/guides/about-a2/en/audience-targeting)
    name: Audience Segment
  - description: The Analytic API provides access to dashboard and A2 metric data.
    name: Analytic
  - description: >

      The Billing API manages billing information.

      A2 is configured to work with the payment systems used by your retail
      platform.


      To integrate payments, first you need to register an external channel.

      For more information about integrating A2 with external channels, check
      out [the External channels
      page](https://docs.aiderx.io/guides/about-a2/en/external-channel).
    name: Billing
  - description: |

      The Campaign API allows you to manage data related to campaigns.

      References:
      - [Campaign](https://docs.aiderx.io/guides/about-a2/en/campaign)
    name: Campaign
  - description: >

      The Creative API provides comprehensive functionalities for managing
      creative assets and related resources.


      References:

      - [Creative](https://docs.aiderx.io/guides/about-a2/en/creative)
    name: Creative
  - description: >

      The Allocation API provides comprehensive functionalities for managing
      allocation and related resources.


      References:

      - [Allocation](https://docs.aiderx.io/guides/about-a2/en/allocation)
    name: Allocation
  - description: >

      The Media Library API provides comprehensive functionalities for managing
      media library and related resources.


      References:

      - [Media Library](https://docs.aiderx.io/guides/about-a2/en/media-library)
    name: Media Library
  - description: >

      The Catalog Management API provides functionalities for managing catalogs
      and related resources.


      References:

      - [First-Party
      Data](https://docs.aiderx.io/guides/about-a2/en/first-party-data)
    name: Catalog
  - description: >

      The Placement Management API provides comprehensive functionalities for
      managing placements and related resources.


      References:

      - [Placement](https://docs.aiderx.io/guides/about-a2/en/placement)
    name: Placement
  - description: >

      Placement Catalog transforms the placement information into a structured
      “advertising product” that can be easily showcased to advertisers.


      References:

      - To be updated
    name: Placement Catalog
  - description: >

      The System APIs allow you to access and manage system-level settings and
      assets, such as logos and configuration values.


      References:

      - [Yield Optimization
      Settings](https://docs.aiderx.io/guides/about-a2/en/yield-optimization)
    name: System
  - description: >

      The Auth and User API provides authentication and user management
      functionalities.


      References:

      - [Account and
      Budget](https://docs.aiderx.io/guides/about-a2/en/account-and-budget)
    name: Auth and User
  - description: |

      The License API provides license management functionalities.
    name: License
paths:
  /campaigns:
    patch:
      tags:
        - Campaign
      summary: Update a campaign
      description: >-
        Updates an existing advertising campaign and returns information about
        the updated campaign.


        Access Control:

        - Only the owner of the campaign can update it.


        _If you change the campaign to archived, the budget allocated to the
        campaign is returned._
      operationId: handle_update_campaign_campaigns_patch
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignUpdateSchema'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignSchema'
          description: Successful Response
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Unprocessable Content
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    CampaignUpdateSchema:
      description: Schema for updating campaign entity.
      properties:
        audience_segments:
          anyOf:
            - type: object
            - type: 'null'
          description: The list of audience segments for targeting
          title: Audience Segments
        bid_strategy:
          deprecated: true
          description: Bidding strategy for the campaign
          enum:
            - highest_volume
            - bid_cap
          title: Bid Strategy
          type: string
        budget:
          default: 0
          description: The total budget of the campaign
          title: Budget
          type: number
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: The date and time the entity was created.
          title: Created At
        crid:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          deprecated: true
          title: Crid
        daily_budget:
          anyOf:
            - type: number
            - type: 'null'
          deprecated: true
          title: Daily Budget
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: The description of the campaign
          title: Description
        end_date:
          description: The datetime in RFC 3339 format when the campaign ends.
          format: date-time
          title: End Date
          type: string
        goal:
          description: Campaign objective
          enum:
            - click
            - reach
            - impression
            - conversion
          title: Goal
          type: string
        id:
          format: uuid
          title: Id
          type: string
        max_bid:
          default: 0
          description: |-
            Maximum bid per impression
                    (only available for 'maximize_volume' bid strategy)
          minimum: 0
          title: Max Bid
          type: number
        min_daily_imp:
          default: 1000
          description: Internal purpose
          minimum: 1000
          title: Min Daily Imp
          type: number
        name:
          description: The name of the campaign.
          title: Name
          type: string
        owner_id:
          description: The owner's ID of the campaign
          format: uuid
          title: Owner Id
          type: string
        start_date:
          description: |

            The datetime in RFC 3339 format when the campaign starts.
            For example, 2017-07-21 17:32:28
          format: date-time
          title: Start Date
          type: string
        status:
          $ref: '#/components/schemas/CampaignStatus'
        sub_goal:
          anyOf:
            - type: string
            - type: 'null'
          description: The sub-goal of the campaign
          title: Sub Goal
        tagid:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          deprecated: true
          title: Tagid
        target_cpa:
          default: 0
          description: Target cost per action
          minimum: 0
          title: Target Cpa
          type: number
        target_cpm:
          default: 0
          description: |-
            Target cost per thousand impressions
                    (only available for 'target_cpm' sub-goal)
          minimum: 0
          title: Target Cpm
          type: number
        target_volume:
          default: 0
          description: |-
            Guaranteed impressions within the campaign period
                    (only available for 'target_volume' sub-goal)
          minimum: 0
          title: Target Volume
          type: number
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: The date and time the entity was last updated.
          title: Updated At
      required:
        - name
        - start_date
        - end_date
        - goal
        - status
        - bid_strategy
        - owner_id
        - id
      title: CampaignUpdateSchema
      type: object
    CampaignSchema:
      description: >-
        Schema representing a campaign entity with all its properties and
        metadata.
      properties:
        audience_segments:
          anyOf:
            - type: object
            - type: 'null'
          description: The list of audience segments for targeting
          title: Audience Segments
        bid_strategy:
          deprecated: true
          description: Bidding strategy for the campaign
          enum:
            - highest_volume
            - bid_cap
          title: Bid Strategy
          type: string
        budget:
          default: 0
          description: The total budget of the campaign
          title: Budget
          type: number
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: The date and time the entity was created.
          title: Created At
        crid:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          deprecated: true
          title: Crid
        daily_budget:
          anyOf:
            - type: number
            - type: 'null'
          deprecated: true
          title: Daily Budget
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: The description of the campaign
          title: Description
        end_date:
          description: The datetime in RFC 3339 format when the campaign ends.
          title: End Date
          type: string
        goal:
          description: Campaign objective
          enum:
            - click
            - reach
            - impression
            - conversion
          title: Goal
          type: string
        id:
          description: The id of the campaign
          format: uuid
          title: Id
          type: string
        max_bid:
          default: 0
          description: |-
            Maximum bid per impression
                    (only available for 'maximize_volume' bid strategy)
          minimum: 0
          title: Max Bid
          type: number
        min_daily_imp:
          default: 1000
          description: Internal purpose
          minimum: 1000
          title: Min Daily Imp
          type: number
        name:
          description: The name of the campaign.
          title: Name
          type: string
        'no':
          title: 'No'
          type: integer
        owner_id:
          description: The owner's ID of the campaign
          format: uuid
          title: Owner Id
          type: string
        start_date:
          description: |

            The datetime in RFC 3339 format when the campaign starts.
            For example, 2017-07-21 17:32:28
          title: Start Date
          type: string
        status:
          $ref: '#/components/schemas/CampaignStatus'
        sub_goal:
          anyOf:
            - type: string
            - type: 'null'
          description: The sub-goal of the campaign
          title: Sub Goal
        tagid:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          deprecated: true
          title: Tagid
        target_cpa:
          default: 0
          description: Target cost per action
          minimum: 0
          title: Target Cpa
          type: number
        target_cpm:
          default: 0
          description: |-
            Target cost per thousand impressions
                    (only available for 'target_cpm' sub-goal)
          minimum: 0
          title: Target Cpm
          type: number
        target_volume:
          default: 0
          description: |-
            Guaranteed impressions within the campaign period
                    (only available for 'target_volume' sub-goal)
          minimum: 0
          title: Target Volume
          type: number
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: The date and time the entity was last updated.
          title: Updated At
      required:
        - name
        - start_date
        - end_date
        - goal
        - status
        - bid_strategy
        - owner_id
        - 'no'
      title: CampaignSchema
      type: object
    HTTPExceptionResponse:
      description: HTTPException response model.
      properties:
        detail:
          description: Detailed explanation for the exception
          title: Detail
          type: string
      required:
        - detail
      title: HTTPExceptionResponse
      type: object
    CampaignStatus:
      description: Enum for campaign status.
      enum:
        - okay
        - preparing
        - ready
        - archived
      title: CampaignStatus
      type: string
  securitySchemes:
    OAuth2PasswordBearer:
      flows:
        password:
          scopes: {}
          tokenUrl: auth/jwt/login
      type: oauth2

````