# Get campaign reporting

GET https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/{campaignId}

Retrieve reporting for one campaign as a flat object, not the `{ grouped, totals }` envelope the account-level report uses. Merges the locally stored campaign, Meta insights for the window, and CDP-attributed contacts. The campaign must be published — one without an `fbCampaignId` is rejected. Note `results.lead` (Meta lead actions) and `leads` (CDP attributed contacts) measure different things and routinely disagree.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `adPublishing.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `campaignId` | string | Yes | Campaign identifier |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location identifier |
| `startDate` | string | Yes | Report start date (YYYY-MM-DD) |
| `endDate` | string | Yes | Report end date (YYYY-MM-DD) |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v4"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/ad-publishing/facebook/reporting/campaign/{campaignId}": {
      "get": {
        "summary": "Get campaign reporting",
        "operationId": "getCampaignReporting",
        "description": "Retrieve reporting for one campaign as a flat object, not the `{ grouped, totals }` envelope the account-level report uses. Merges the locally stored campaign, Meta insights for the window, and CDP-attributed contacts. The campaign must be published — one without an `fbCampaignId` is rejected. Note `results.lead` (Meta lead actions) and `leads` (CDP attributed contacts) measure different things and routinely disagree.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v4"
              ]
            }
          },
          {
            "name": "campaignId",
            "required": true,
            "in": "path",
            "description": "Campaign identifier",
            "schema": {
              "example": "507f1f77bcf86cd799439011",
              "type": "string"
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "Location identifier",
            "schema": {
              "example": "fRMewNQIxSyZ5R4nQyit",
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "required": true,
            "in": "query",
            "description": "Report start date (YYYY-MM-DD)",
            "schema": {
              "example": "2022-01-11",
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "required": true,
            "in": "query",
            "description": "Report end date (YYYY-MM-DD)",
            "schema": {
              "example": "2022-01-31",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign metadata, Meta insights, and attributed contacts for the window",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FacebookCampaignReportingDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "adPublishing.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "FacebookCampaignReportingDTO": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Campaign id in this service. Note `_id`, not `id`.",
            "example": "6890a65597bae1febe1581d1"
          },
          "name": {
            "type": "string",
            "description": "Campaign name",
            "example": "Do not touch - Lead Form Campaign"
          },
          "objective": {
            "type": "string",
            "description": "Campaign objective",
            "example": "OUTCOME_LEADS"
          },
          "publishingStatus": {
            "type": "string",
            "description": "Local publishing status",
            "example": "PAUSED"
          },
          "fbCampaignId": {
            "type": "string",
            "description": "Meta campaign id. Required — an unpublished campaign is rejected.",
            "example": "120229485769880122"
          },
          "campaignId": {
            "type": "string",
            "description": "Meta campaign id, repeated from the insights row",
            "example": "120229485769880122"
          },
          "startTime": {
            "type": "string",
            "description": "When the campaign started, in Meta timestamp format with a numeric offset rather than UTC",
            "example": "2025-08-04T05:24:01-0700"
          },
          "stopTime": {
            "type": "string",
            "description": "When the campaign is scheduled to stop. Absent on open-ended campaigns.",
            "example": "2026-09-01T00:00:00-0700"
          },
          "dateStart": {
            "type": "string",
            "description": "First day of the reported window",
            "example": "2025-08-01"
          },
          "dateStop": {
            "type": "string",
            "description": "Last day of the reported window",
            "example": "2026-08-19"
          },
          "clicks": {
            "type": "string",
            "description": "Clicks",
            "example": "32"
          },
          "cpc": {
            "type": "string",
            "description": "Cost per click",
            "example": "0.03625"
          },
          "ctr": {
            "type": "string",
            "description": "Click-through rate as a percentage",
            "example": "1.440792"
          },
          "cpm": {
            "type": "string",
            "description": "Cost per thousand impressions",
            "example": "0.522287"
          },
          "impressions": {
            "type": "string",
            "description": "Impressions",
            "example": "2221"
          },
          "spend": {
            "type": "string",
            "description": "Spend",
            "example": "1.16"
          },
          "reach": {
            "type": "string",
            "description": "Unique people reached",
            "example": "2214"
          },
          "frequency": {
            "type": "string",
            "description": "Average impressions per person reached",
            "example": "1.003162"
          },
          "conversions": {
            "type": "string",
            "description": "Lead actions Meta recorded. A string here, unlike the account-level report where the same figure is a number.",
            "example": "5"
          },
          "costPerConversion": {
            "type": "string",
            "description": "Spend divided by lead actions",
            "example": "0.232"
          },
          "results": {
            "type": "object",
            "description": "Counts per Meta action type. Values are strings, and the types overlap so summing them double-counts.",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "lead": "5",
              "linkClick": "22"
            }
          },
          "costPerResult": {
            "type": "string",
            "description": "Spend divided by the double-counted `results` total, so usually far smaller than the real cost per lead",
            "example": "0.01"
          },
          "costPerResultBreakdown": {
            "type": "object",
            "description": "Cost per action, per action type, at four decimals",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "lead": "0.2320",
              "linkClick": "0.0527"
            }
          },
          "leads": {
            "type": "string",
            "description": "Contacts the CDP attributed to this campaign. A different measurement from `results.lead`, which counts Meta lead actions — expect the two to differ.",
            "example": "4"
          }
        },
        "required": [
          "_id",
          "name",
          "objective",
          "publishingStatus",
          "fbCampaignId"
        ],
        "title": "FacebookCampaignReportingDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for an unexpected server error",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message describing the server failure",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/<campaignId>?locationId=<LOCATIONID>&startDate=<STARTDATE>&endDate=<ENDDATE>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v4'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v4'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/<campaignId>?locationId=<LOCATIONID>&startDate=<STARTDATE>&endDate=<ENDDATE>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/{campaignId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v4"
}

params = {
    "locationId": "<LOCATIONID>",
    "startDate": "<STARTDATE>",
    "endDate": "<ENDDATE>"
}

response = requests.get(url, params=params, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/<campaignId>?locationId=<LOCATIONID>&startDate=<STARTDATE>&endDate=<ENDDATE>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v4',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/<campaignId>?locationId=<LOCATIONID>&startDate=<STARTDATE>&endDate=<ENDDATE>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v4")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/<campaignId>?locationId=<LOCATIONID>&startDate=<STARTDATE>&endDate=<ENDDATE>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v4")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/<campaignId>?locationId=<LOCATIONID>&startDate=<STARTDATE>&endDate=<ENDDATE>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v4"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v4"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/ad-publishing/facebook/reporting/campaign/<campaignId>?locationId=<LOCATIONID>&startDate=<STARTDATE>&endDate=<ENDDATE>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
