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

# Update Campaign

> Update an existing campaign's name, status, or budget.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.adrelay.dev/v1/campaigns/camp_abc123" \
    -H "X-API-Key: $ADRELAY_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "status": "ACTIVE",
      "budget_amount": 75.00
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.adrelay.dev/v1/campaigns/camp_abc123",
    {
      method: "PATCH",
      headers: {
        "X-API-Key": process.env.ADRELAY_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        status: "ACTIVE",
        budget_amount: 75.0,
      }),
    }
  );

  const campaign = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.patch(
      "https://api.adrelay.dev/v1/campaigns/camp_abc123",
      headers={
          "X-API-Key": "your-api-key-here",
          "Content-Type": "application/json",
      },
      json={"status": "ACTIVE", "budget_amount": 75.00},
  )

  campaign = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "camp_abc123",
    "platform": "google_ads",
    "remote_id": "123456789",
    "name": "Summer Sale 2026",
    "status": "ACTIVE",
    "goal": "CONVERSIONS",
    "budget_amount": 75.00,
    "budget_period": "DAILY",
    "currency": "USD",
    "created_at": "2026-03-01T12:00:00Z",
    "updated_at": "2026-03-21T10:30:00Z"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Campaign not found.",
    "code": "NOT_FOUND",
    "timestamp": 1711036800,
    "request_id": "req_abc123"
  }
  ```
</ResponseExample>

Only the fields you include in the request body will be updated. All other fields remain unchanged.


## OpenAPI

````yaml PATCH /v1/campaigns/{id}
openapi: 3.1.0
info:
  title: Adrelay API
  version: 0.1.0
  description: >-
    Unified Ad Platform API — proxy and normalize campaigns across Google Ads,
    Meta, TikTok, and more.
servers:
  - url: https://api.adrelay.dev/v1
    description: Production
  - url: http://localhost:3001
    description: Local
security: []
paths:
  /v1/campaigns/{id}:
    patch:
      summary: Update campaign
      description: Updates a campaign by its normalized ID (e.g. google_123).
      parameters:
        - schema:
            type: string
            pattern: ^(google|meta|tiktok)_\w+$
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                organization_id:
                  type: string
                  minLength: 1
                name:
                  type: string
                  minLength: 1
                  maxLength: 255
                status:
                  $ref: '#/components/schemas/AdsStatus'
                budget_amount:
                  type: number
                budget_period:
                  $ref: '#/components/schemas/AdsBudgetPeriod'
                currency:
                  type: string
              required:
                - organization_id
      responses:
        '200':
          description: Updated campaign
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCampaignResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Campaign or connection not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - apiKey: []
components:
  schemas:
    AdsStatus:
      type: string
      enum:
        - UNSPECIFIED
        - ACTIVE
        - PAUSED
        - ARCHIVED
        - DRAFT
        - SCHEDULED_FOR_DELETION
    AdsBudgetPeriod:
      type: string
      enum:
        - DAILY
        - MONTHLY
        - TOTAL
        - LIFETIME
    CreateCampaignResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/AdsCampaign'
      required:
        - data
    ErrorEnvelope:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
            platform:
              type: string
            retryable:
              type: boolean
            requestId:
              type: string
              format: uuid
            platformError:
              $ref: '#/components/schemas/PlatformErrorDetail'
          required:
            - code
            - message
            - retryable
            - requestId
      required:
        - error
    AdsCampaign:
      type: object
      properties:
        id:
          type: string
        platform:
          $ref: '#/components/schemas/Platform'
        organization_id:
          type: string
        name:
          type: string
        status:
          $ref: '#/components/schemas/AdsStatus'
        goal:
          $ref: '#/components/schemas/AdsCampaignGoalType'
        budget_amount:
          type: number
        budget_period:
          $ref: '#/components/schemas/AdsBudgetPeriod'
        currency:
          type: string
        total_spend_amount:
          type: number
        start_at:
          type:
            - string
            - 'null'
        end_at:
          type:
            - string
            - 'null'
        created_at:
          type:
            - string
            - 'null'
        updated_at:
          type:
            - string
            - 'null'
        raw:
          type: object
          additionalProperties: {}
      required:
        - id
        - platform
        - organization_id
        - name
        - status
    ErrorCode:
      type: string
      enum:
        - BAD_REQUEST
        - UNAUTHORIZED
        - FORBIDDEN
        - NOT_FOUND
        - CONFLICT
        - RATE_LIMITED
        - RATE_LIMIT_EXCEEDED
        - PLATFORM_ERROR
        - NOT_SUPPORTED
        - TOKEN_EXPIRED
        - INTERNAL_ERROR
    PlatformErrorDetail:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        field:
          type: string
      required:
        - message
    Platform:
      type: string
      enum:
        - GOOGLE
        - META
        - TIKTOK
        - LINKEDIN
        - PINTEREST
        - REDDIT
    AdsCampaignGoalType:
      type: string
      enum:
        - UNSPECIFIED
        - BRAND_AWARENESS
        - REACH
        - WEBSITE_TRAFFIC
        - LEADS
        - SALES
        - APP_PROMOTION
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key

````