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

# Get Campaigns

> Retrieve a list of all campaigns for a company with pagination, filtering, and sorting capabilities.

This endpoint provides comprehensive access to all campaigns associated with a company. It supports pagination, filtering by status, and sorting to efficiently manage large numbers of campaigns.

<Info>
  This endpoint returns essential campaign information optimized for list views and campaign management interfaces. For detailed campaign information, use the Get Campaign Details endpoint.
</Info>

### Path Parameters

<ParamField path="company_id" type="string" required>
  The unique identifier of the company whose campaigns you want to retrieve
</ParamField>

### Query Parameters

<ParamField query="limit" type="integer" optional default="20">
  Maximum number of campaigns to return per request (max 100)
</ParamField>

<ParamField query="offset" type="integer" optional default="0">
  Number of campaigns to skip for pagination
</ParamField>

<ParamField query="order" type="string" optional default="DESC">
  Sort order for campaigns: "ASC" (ascending) or "DESC" (descending)
</ParamField>

<ParamField query="status" type="string" optional>
  Filter campaigns by status: "active", "inactive", "scheduled", "expired"
</ParamField>

<ParamField query="search" type="string" optional>
  Search campaigns by name or description
</ParamField>

<ParamField query="start_date_from" type="string" optional>
  Filter campaigns starting after this date (YYYY-MM-DD)
</ParamField>

<ParamField query="start_date_to" type="string" optional>
  Filter campaigns starting before this date (YYYY-MM-DD)
</ParamField>

### Response

<ResponseField name="campaigns" type="array">
  Array of campaign objects

  <Expandable title="Campaign Object">
    <ResponseField name="id" type="string">
      Unique campaign identifier
    </ResponseField>

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

    <ResponseField name="image" type="string">
      URL to campaign image asset
    </ResponseField>

    <ResponseField name="start_date" type="string">
      Campaign start date (YYYY-MM-DD)
    </ResponseField>

    <ResponseField name="end_date" type="string">
      Campaign end date (YYYY-MM-DD)
    </ResponseField>

    <ResponseField name="status" type="string">
      Current campaign status
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object">
  Pagination information for the response

  <Expandable title="Pagination Details">
    <ResponseField name="total_campaigns" type="integer">
      Total number of campaigns matching filters
    </ResponseField>

    <ResponseField name="current_page" type="integer">
      Current page number (calculated from offset and limit)
    </ResponseField>

    <ResponseField name="total_pages" type="integer">
      Total number of pages available
    </ResponseField>

    <ResponseField name="has_next_page" type="boolean">
      Whether there are more campaigns available
    </ResponseField>

    <ResponseField name="has_previous_page" type="boolean">
      Whether there are previous campaigns available
    </ResponseField>
  </Expandable>
</ResponseField>

### Response Example

```json theme={null}
[
  {
    "id": "1000007",
    "image": "https://lula-stores-service-staging.s3.amazonaws.com/company/1000058/campaigns/1000007/1741976976661.webp",
    "name": "Summer Essentials Campaign",
    "start_date": "2025-06-01",
    "end_date": "2025-08-31",
    "status": "active"
  },
  {
    "id": "1000008",
    "image": "https://lula-stores-service-staging.s3.amazonaws.com/company/1000058/campaigns/1000008/1741977281470.webp",
    "name": "Back to School Special",
    "start_date": "2025-08-15",
    "end_date": "2025-09-15",
    "status": "scheduled"
  },
  {
    "id": "1000009",
    "image": "https://lula-stores-service-staging.s3.amazonaws.com/company/1000058/campaigns/1000009/1741977365382.webp",
    "name": "Holiday Season Promotions",
    "start_date": "2025-11-01",
    "end_date": "2025-12-31",
    "status": "scheduled"
  },
  {
    "id": "1000010",
    "image": "https://lula-stores-service-staging.s3.amazonaws.com/company/1000058/campaigns/1000010/1744591882710.webp",
    "name": "Spring Fresh Campaign",
    "start_date": "2025-03-01",
    "end_date": "2025-05-31",
    "status": "active"
  }
]
```

<Accordion title="Filter and Search Examples">
  **Get Active Campaigns Only**

  ```
  GET {{micro_service_base_url}}/stores/company/{{company_id}}/campaigns?status=active
  ```

  **Search Campaigns by Name**

  ```
  GET {{micro_service_base_url}}/stores/company/{{company_id}}/campaigns?search=summer
  ```

  **Get Campaigns with Pagination**

  ```
  GET {{micro_service_base_url}}/stores/company/{{company_id}}/campaigns?limit=10&offset=20
  ```

  **Get Upcoming Campaigns**

  ```
  GET {{micro_service_base_url}}/stores/company/{{company_id}}/campaigns?status=scheduled&order=ASC
  ```

  **Filter by Date Range**

  ```
  GET {{micro_service_base_url}}/stores/company/{{company_id}}/campaigns?start_date_from=2025-06-01&start_date_to=2025-12-31
  ```
</Accordion>

<Note>
  **Performance Optimization**: Use pagination (limit and offset) when dealing with companies that have many campaigns to ensure fast response times and efficient resource usage.
</Note>

<Tip>
  **Search Functionality**: The search parameter performs case-insensitive matching against both campaign names and descriptions, making it easy to find specific campaigns.
</Tip>

### Campaign Status Overview

<Accordion title="Understanding Campaign Status">
  **active**: Currently running campaigns

  * Promotions are being applied
  * Visible to customers
  * Within start and end date range

  **inactive**: Paused or disabled campaigns

  * Not currently applying promotions
  * Hidden from customers
  * Can be reactivated at any time

  **scheduled**: Future campaigns

  * Set to start automatically on start\_date
  * Not yet visible to customers
  * Can be modified before activation

  **expired**: Past campaigns

  * End date has passed
  * No longer applying promotions
  * Archived for historical reference
</Accordion>

### Use Cases

<Accordion title="Common Campaign Management Scenarios">
  **Campaign Dashboard**

  * Display overview of all active campaigns
  * Monitor campaign performance at a glance
  * Quick access to campaign management actions

  **Campaign Planning**

  * Review upcoming scheduled campaigns
  * Plan campaign calendars and timing
  * Identify gaps in marketing coverage

  **Performance Analysis**

  * Compare active vs inactive campaigns
  * Analyze campaign timing and duration
  * Identify successful campaign patterns

  **Campaign Administration**

  * Bulk campaign management operations
  * Search and filter for specific campaigns
  * Organize campaigns by status and timing
</Accordion>

### Error Responses

<Accordion title="Common Error Scenarios">
  **Company Not Found**

  ```json theme={null}
  {
    "error": "Company not found",
    "message": "The specified company does not exist",
    "code": "COMPANY_NOT_FOUND"
  }
  ```

  **Invalid Parameters**

  ```json theme={null}
  {
    "error": "Invalid parameters",
    "message": "Limit must be between 1 and 100",
    "code": "INVALID_PARAMETERS"
  }
  ```

  **Invalid Date Format**

  ```json theme={null}
  {
    "error": "Invalid date format",
    "message": "Date must be in YYYY-MM-DD format",
    "code": "INVALID_DATE_FORMAT"
  }
  ```
</Accordion>

<Warning>
  **Large Result Sets**: When requesting campaigns without pagination, large companies may experience slower response times. Always use pagination for production applications.
</Warning>
