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

# Update an existing campaign

> Update an existing campaign.



## OpenAPI

````yaml openapi/admin.json PATCH /campaigns/{id}
openapi: 3.1.0
info:
  title: Nudj Admin API
  version: 1.0.0
servers:
  - url: https://{subdomain}.nudj.cx/api/v2/admin
    description: Organization API Server
    variables:
      subdomain:
        description: Your organization's subdomain (required)
        default: your-org
security:
  - ApiToken: []
paths:
  /campaigns/{id}:
    patch:
      tags:
        - Campaign
      summary: Update an existing campaign
      description: Update an existing campaign.
      operationId: updateCampaign
      parameters:
        - in: path
          name: id
          description: The id of the campaign to update
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
            description: The id of the campaign to update
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: The name of the campaign
                startDate:
                  type: string
                  description: The start date of the campaign
                endDate:
                  type: string
                  description: The end date of the campaign
                status:
                  type: string
                  enum:
                    - archived
                    - draft
                    - expired
                    - live
                    - scheduled
                  description: The status of the campaign
              description: The input required to update a campaign
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Campaign'
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.NOT_FOUND'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
components:
  schemas:
    Campaign:
      type: object
      properties:
        id:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the campaign
        organisationId:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the organisation the campaign belongs to
        name:
          type: string
          description: The name of the campaign
        startDate:
          type: string
          description: The start date of the campaign
        endDate:
          type: string
          description: The end date of the campaign
        status:
          type: string
          enum:
            - archived
            - draft
            - expired
            - live
            - scheduled
          description: The status of the campaign
        createdAt:
          type: string
          description: The date the campaign was created
        updatedAt:
          type: string
          description: The date the campaign was last updated
        createdBy:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The user who created this campaign
        updatedBy:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The user who last updated this campaign
      required:
        - id
        - organisationId
        - name
        - startDate
        - endDate
        - status
        - createdAt
        - updatedAt
        - createdBy
        - updatedBy
      title: Campaign
      description: A campaign
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.NOT_FOUND:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Not found
        code:
          type: string
          description: The error code
          example: NOT_FOUND
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: NOT_FOUND
        message: Not found
        issues: []
    error.INTERNAL_SERVER_ERROR:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Internal server error
        code:
          type: string
          description: The error code
          example: INTERNAL_SERVER_ERROR
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
  securitySchemes:
    ApiToken:
      type: apiKey
      in: header
      name: x-api-token

````