Facebook Pixel
APILinkedIn Analytics

Get weekly engagement data

Retrieve weekly engagement statistics for email reports. Returns comment and reaction counts broken down by day for the past 7 days, along with summary statistics and analytics data. Useful for automated weekly reports.

GET/engagement/weekly
Authentication requiredAnalytics

Code Examples

curl -X GET 'https://api.connectsafely.ai/linkedin/engagement/weekly' \
-H 'Authorization: Bearer <your_api_key>'

Parameters

NameInRequiredTypeDescription
accountIdqueryNostringLinkedIn account ID to use. If not provided, uses the default account.

Request Body

No request body.

Responses

StatusDescription
200Weekly engagement data retrieved successfully
400Bad Request - Account does not have profile ID
401Unauthorized - Invalid or missing API key
500Internal Server Error - Failed to get LinkedIn credentials or engagement data

200 Response Parameters

NameTypeDescription
successboolean
accountIdstring
profileIdstring
periodobject
summaryobject
dailyBreakdownarray
analyticsobjectLinkedIn analytics data (followers, engagement metrics)
accountInfoobject

200 Example

{
  "success": true,
  "accountId": "696ce9e780e0483585e4e553",
  "profileId": "ACoAAATPlQ0Bc8wdg-Iy8wZgEDuSdIVWJiE1Aio",
  "period": {
    "startDate": "2026-02-16",
    "endDate": "2026-02-23",
    "days": 7
  },
  "summary": {
    "totalComments": 250,
    "totalReactions": 250,
    "totalEngagements": 500,
    "avgEngagementsPerDay": 250,
    "daysWithActivity": 2,
    "mostActiveDay": "2026-02-22"
  },
  "dailyBreakdown": [
    {
      "date": "2026-02-16",
      "comments": 0,
      "reactions": 0,
      "total": 0
    },
    {
      "date": "2026-02-17",
      "comments": 0,
      "reactions": 0,
      "total": 0
    },
    {
      "date": "2026-02-21",
      "comments": 37,
      "reactions": 25,
      "total": 62
    },
    {
      "date": "2026-02-22",
      "comments": 69,
      "reactions": 77,
      "total": 146
    }
  ],
  "analytics": {
    "summary": {
      "metrics": [
        {
          "title": "Total followers",
          "value": "12,841",
          "change": 0.9
        }
      ]
    },
    "chart": {
      "title": "New followers",
      "points": [
        {
          "date": "Feb 21",
          "value": 72
        }
      ]
    }
  },
  "accountInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "publicId": "john-doe"
  }
}

400 Response Parameters

NameTypeDescription
errorstring

400 Example

{
  "error": "LinkedIn account does not have a profile ID. Please reconnect your LinkedIn account.",
  "success": false
}

401 Response Parameters

NameTypeDescription
errorstring

401 Example

{
  "error": "Unauthorized - Invalid credentials"
}

500 Response Parameters

NameTypeDescription
errorstring

500 Example

{
  "error": "Failed to get weekly engagement data",
  "success": false
}