# Get campaign stats

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /analytics/campaign/stats:
    get:
      summary: Get campaign stats
      deprecated: false
      description: >-
        Retrieve detailed statistics for a specific campaign or all campaigns
        within a workspace. Users can track metrics such as lead count,
        completion status, contact interactions, and more to gain insights into
        campaign performance and engagement levels. This section provides
        valuable data for analyzing and optimizing marketing strategies.


        Get the statistics for a campaign or all campaigns
      operationId: Analytics_analytics/get-campaign-stats
      tags:
        - Analytics
        - Analytics
      parameters:
        - name: workspace_id
          in: query
          description: The ID of the workspace associated with the campaign.
          required: true
          schema:
            type: string
            description: The ID of the workspace associated with the campaign.
            default: ''
            examples:
              - 65f3c92d3dbe5dbb35374a9a
        - name: campaign_id
          in: query
          description: >-
            Campaign ID (If not passed, the endpoint will return all campaigns
            of the workspace)
          required: false
          schema:
            type: string
            description: >-
              Campaign ID (If not passed, the endpoint will return all campaigns
              of the workspace)
            default: ''
            examples:
              - 66b447598f6dd99f7f7b5c0a
        - name: start_date
          in: query
          description: The start date of the analytics period.
          required: true
          schema:
            type: string
            description: The start date of the analytics period.
            default: ''
            format: date
            examples:
              - '2024-06-21'
        - name: end_date
          in: query
          description: The optional end date of the analytics period.
          required: false
          schema:
            type: string
            description: The optional end date of the analytics period.
            default: ''
            format: date
            examples:
              - '2024-06-30'
        - name: x-api-key
          in: header
          description: |
            Your PlusVibe.ai account's API Key
          required: true
          example: ''
          schema:
            type: string
            description: |
              Your PlusVibe.ai account's API Key
            default: ''
            examples:
              - your-api-key
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  '0':
                    type: object
                    description: ''
                    properties:
                      _id:
                        type: string
                        description: The unique identifier for the campaign.
                        examples:
                          - 6708335e989304cbe094646e
                      camp_name:
                        type: string
                        description: The name of the campaign.
                        examples:
                          - Campagin 1
                      status:
                        type: string
                        description: The current status of the campaign.
                        examples:
                          - COMPLETED
                      lead_count:
                        type: number
                        description: The total number of leads in the campaign.
                        examples:
                          - 3088
                      completed_lead_count:
                        type: number
                        description: >-
                          The number of leads that have been successfully
                          completed since the launch of the campaign
                        examples:
                          - 3088
                      lead_contacted_count:
                        type: number
                        description: >-
                          Total number of leads contacted within the given time
                          frame, including those previously engaged in earlier
                          steps
                        examples:
                          - 3087
                      new_completed_lead_count:
                        type: number
                        description: >-
                          The number of leads that have been successfully
                          completed during the given time frame
                        examples:
                          - 300
                      new_lead_contacted_count:
                        type: number
                        description: >-
                          The number of unique leads contacted for the first
                          time within the given time frame
                        examples:
                          - 250
                      sent_count:
                        type: number
                        description: The total number of emails sent in the campaign.
                        examples:
                          - 8585
                      unique_opened_count:
                        type: number
                        description: >-
                          The number of unique recipients who opened the
                          campaign.
                      replied_count:
                        type: number
                        description: The number of recipients who replied to the campaign.
                        examples:
                          - 234
                      bounced_count:
                        type: number
                        description: >-
                          The number of emails that bounced back from the
                          campaign.
                        examples:
                          - 67
                      unsubscribed_count:
                        type: number
                        description: >-
                          The number of recipients who unsubscribed from the
                          campaign.
                      created_at:
                        type: string
                        description: The date and time when the campaign was created.
                        examples:
                          - '2024-10-10T20:04:46.742Z'
                      positive_reply_count:
                        type: number
                        description: >-
                          The number of recipients who replied positively to the
                          campaign.
                        examples:
                          - 123
                      opportunity_val:
                        type: number
                        description: The total value of opportunities from the campaign.
                        examples:
                          - 61500
                      start_date:
                        type: string
                        description: The start date of the analytics period.
                        examples:
                          - '2024-10-01T00:00:00.000Z'
                      end_date:
                        type: string
                        description: The optional end date of the analytics period.
                        examples:
                          - '2024-11-04T23:59:59.999Z'
                      opportunity_val_per_count:
                        type: number
                        description: The value of opportunities per positive reply
                        examples:
                          - 500
                    x-apidog-orders:
                      - _id
                      - camp_name
                      - status
                      - lead_count
                      - completed_lead_count
                      - lead_contacted_count
                      - new_completed_lead_count
                      - new_lead_contacted_count
                      - sent_count
                      - unique_opened_count
                      - replied_count
                      - bounced_count
                      - unsubscribed_count
                      - created_at
                      - positive_reply_count
                      - opportunity_val
                      - start_date
                      - end_date
                      - opportunity_val_per_count
                  '1':
                    type: object
                    description: >-
                      A placeholder for a specific parameter that is not
                      explicitly defined.
                    properties:
                      _id:
                        type: string
                        description: The unique identifier for the campaign.
                        examples:
                          - 66facebf131507b299c5016f
                      camp_name:
                        type: string
                        description: The name of the campaign.
                        examples:
                          - Campaign 2
                      status:
                        type: string
                        description: The current status of the campaign.
                        examples:
                          - COMPLETED
                      lead_count:
                        type: number
                        description: The total number of leads in the campaign.
                        examples:
                          - 986
                      completed_lead_count:
                        type: number
                        description: >-
                          The number of leads that have been successfully
                          completed since the launch of the campaign
                        examples:
                          - 986
                      lead_contacted_count:
                        type: number
                        description: >-
                          Total number of leads contacted within the given time
                          frame, including those previously engaged in earlier
                          steps
                        examples:
                          - 946
                      new_completed_lead_count:
                        type: number
                        description: >-
                          The number of leads that have been successfully
                          completed during the given time frame
                        examples:
                          - 946
                      new_lead_contacted_count:
                        type: number
                        description: >-
                          The number of unique leads contacted for the first
                          time within the given time frame
                        examples:
                          - 946
                      sent_count:
                        type: number
                        description: The total number of emails sent in the campaign.
                        examples:
                          - 2283
                      unique_opened_count:
                        type: number
                        description: >-
                          The number of unique recipients who opened the
                          campaign.
                      replied_count:
                        type: number
                        description: The number of recipients who replied to the campaign.
                        examples:
                          - 113
                      bounced_count:
                        type: number
                        description: The count of emails that bounced back from recipients.
                        examples:
                          - 33
                      unsubscribed_count:
                        type: number
                        description: >-
                          The count of recipients who unsubscribed from the
                          campaign.
                      created_at:
                        type: string
                        description: >-
                          The date and time when the campaign stats were
                          created.
                        examples:
                          - '2024-09-30T16:15:59.541Z'
                      positive_reply_count:
                        type: number
                        description: >-
                          The number of recipients who replied positively to the
                          campaign.
                        examples:
                          - 77
                      opportunity_val:
                        type: number
                        description: >-
                          The total value of opportunities linked to the
                          campaign.
                        examples:
                          - 38500
                      start_date:
                        type: string
                        description: The start date of the campaign statistics.
                        examples:
                          - '2024-10-01T00:00:00.000Z'
                      end_date:
                        type: string
                        description: The optional end date of the analytics period.
                        examples:
                          - '2024-11-04T23:59:59.999Z'
                      opportunity_val_per_count:
                        type: number
                        description: The value of opportunities per positive reply
                        examples:
                          - 500
                    x-apidog-orders:
                      - _id
                      - camp_name
                      - status
                      - lead_count
                      - completed_lead_count
                      - lead_contacted_count
                      - new_completed_lead_count
                      - new_lead_contacted_count
                      - sent_count
                      - unique_opened_count
                      - replied_count
                      - bounced_count
                      - unsubscribed_count
                      - created_at
                      - positive_reply_count
                      - opportunity_val
                      - start_date
                      - end_date
                      - opportunity_val_per_count
                x-apidog-orders:
                  - '0'
                  - '1'
          headers: {}
          x-apidog-name: OK
        '400':
          description: Validation or other error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The message associated with the campaign statistics.
                    examples:
                      - Campaign not found
                  error:
                    type: string
                    description: Any error message associated with the campaign stats.
                    examples:
                      - Campaign not found
                x-apidog-orders:
                  - message
                  - error
          headers: {}
          x-apidog-name: Bad Request
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties: {}
                x-apidog-orders: []
          headers: {}
          x-apidog-name: Server Error
      security:
        - ApiKeyAuth: []
          x-apidog:
            schemeGroups:
              - id: uS5KiuC4wfZHK42AzOfA_
                schemeIds:
                  - ApiKeyAuth
            required: true
            use:
              id: uS5KiuC4wfZHK42AzOfA_
            scopes:
              uS5KiuC4wfZHK42AzOfA_:
                ApiKeyAuth: []
      x-apidog-folder: Analytics
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/929054/apis/api-17238023-run
components:
  schemas: {}
  securitySchemes:
    ApiKeyAuth:
      type: apikey
      in: header
      name: x-api-key
      description: |
        API key issued in the PlusVibe dashboard. The server reads it
        from the `x-api-key` header and injects it into the request as
        the `api_key` query parameter, which is why you will see
        `api_key` referenced in validation errors.
    apiKey:
      type: apikey
      in: body
      name: api_key
      description: API key passed in request body
servers:
  - url: https://api.plusvibe.ai/api/v1
    description: Prod Env
security:
  - ApiKeyAuth: []
    x-apidog:
      schemeGroups:
        - id: uS5KiuC4wfZHK42AzOfA_
          schemeIds:
            - ApiKeyAuth
      required: true
      use:
        id: uS5KiuC4wfZHK42AzOfA_
      scopes:
        uS5KiuC4wfZHK42AzOfA_:
          ApiKeyAuth: []

```
