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

# Update Campaign

> Pause or resume a campaign

Update a campaign's state. Currently supports pausing and resuming campaigns.

## Request

<ParamField header="X-API-Key" type="string" required>
  Your API key
</ParamField>

<ParamField path="id" type="string" required>
  The campaign ID
</ParamField>

<ParamField body="action" type="string" required>
  The action to perform. Options: `pause`, `resume`
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the action was successful
</ResponseField>

<ResponseField name="campaignId" type="string">
  Campaign identifier
</ResponseField>

<ResponseField name="action" type="string">
  The action that was performed
</ResponseField>

<ResponseField name="newStatus" type="string">
  The new status of the campaign
</ResponseField>

<ResponseField name="message" type="string">
  Confirmation message
</ResponseField>

<RequestExample>
  ```bash Pause Campaign theme={null}
  curl -X PATCH https://api.sendpilot.ai/v1/campaigns/camp_xyz789 \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "pause"
    }'
  ```

  ```bash Resume Campaign theme={null}
  curl -X PATCH https://api.sendpilot.ai/v1/campaigns/camp_xyz789 \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "resume"
    }'
  ```

  ```javascript Node.js theme={null}
  // Pause campaign
  const response = await fetch('https://api.sendpilot.ai/v1/campaigns/camp_xyz789', {
    method: 'PATCH',
    headers: {
      'X-API-Key': process.env.SENDPILOT_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      action: 'pause'  // or 'resume'
    })
  });
  const result = await response.json();
  ```

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

  response = requests.patch(
      'https://api.sendpilot.ai/v1/campaigns/camp_xyz789',
      headers={
          'X-API-Key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={'action': 'pause'}  # or 'resume'
  )
  result = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Paused theme={null}
  {
    "success": true,
    "campaignId": "camp_xyz789",
    "action": "pause",
    "newStatus": "paused",
    "message": "Campaign paused successfully"
  }
  ```

  ```json Resumed theme={null}
  {
    "success": true,
    "campaignId": "camp_xyz789",
    "action": "resume",
    "newStatus": "active",
    "message": "Campaign resumed successfully"
  }
  ```

  ```json 400 Invalid State theme={null}
  {
    "statusCode": 400,
    "error": "Bad Request",
    "code": "INVALID_CAMPAIGN_STATE",
    "message": "Cannot pause campaign. Current status is 'PAUSED', expected 'STARTED'"
  }
  ```

  ```json 404 theme={null}
  {
    "statusCode": 404,
    "error": "Not Found",
    "code": "CAMPAIGN_NOT_FOUND",
    "message": "Campaign with ID 'camp_xyz789' not found in this workspace"
  }
  ```
</ResponseExample>

<Note>
  When a campaign is paused or resumed, the corresponding webhook event (`campaign.paused` or `campaign.resumed`) will be sent to your registered webhook endpoints.
</Note>


## OpenAPI

````yaml PATCH /v1/campaigns/{id}
openapi: 3.0.0
info:
  title: SendPilot External API
  description: >
    The SendPilot API enables you to programmatically manage LinkedIn outreach
    campaigns,

    add leads, update lead statuses, send messages, and receive real-time
    webhook notifications.
  version: 1.0.0
  contact:
    name: SendPilot Support
    email: support@sendpilot.ai
    url: https://sendpilot.ai
servers:
  - url: https://api.sendpilot.ai
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Credits
    description: Credits and quota management
  - name: Campaigns
    description: Campaign management endpoints
  - name: Leads
    description: Lead management endpoints
  - name: Lead Database
    description: Lead Database search endpoints
  - name: Lead Extractor
    description: Lead extraction campaign endpoints
  - name: Inbox
    description: Direct messaging endpoints
paths:
  /v1/campaigns/{id}:
    patch:
      tags:
        - Campaigns
      summary: Update campaign
      description: Pause or resume a campaign
      operationId: updateCampaign
      parameters:
        - $ref: '#/components/parameters/CampaignId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCampaignRequest'
      responses:
        '200':
          description: Campaign updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateCampaignResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    CampaignId:
      name: id
      in: path
      required: true
      description: Campaign ID
      schema:
        type: string
  schemas:
    UpdateCampaignRequest:
      type: object
      properties:
        action:
          type: string
          enum:
            - pause
            - resume
          description: Action to perform on the campaign
      required:
        - action
    UpdateCampaignResponse:
      type: object
      properties:
        success:
          type: boolean
        campaignId:
          type: string
        action:
          type: string
        newStatus:
          type: string
        message:
          type: string
      required:
        - success
        - campaignId
        - action
        - newStatus
        - message
    Error:
      type: object
      properties:
        statusCode:
          type: integer
        error:
          type: string
        code:
          type: string
        message:
          type: string
      required:
        - statusCode
        - message
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication

````