# Get Social Media Statistics

POST https://services.leadconnectorhq.com/social-media-posting/statistics

Retrieve analytics data for multiple social media accounts. Supports custom date ranges for both the current period and a comparison period. If no date ranges are provided, defaults to the last 7 days (excluding today) with comparison to the previous 7 days.

## Authentication

Send `Authorization: Bearer <token>` using:

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

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location ID (also known as Sub-Account ID) for the business location. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/social-media-posting/statistics": {
      "post": {
        "summary": "Get Social Media Statistics",
        "operationId": "getSocialMediaStatistics",
        "description": "Retrieve analytics data for multiple social media accounts. Supports custom date ranges for both the current period and a comparison period. If no date ranges are provided, defaults to the last 7 days (excluding today) with comparison to the previous 7 days.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "Location ID (also known as Sub-Account ID) for the business location.",
            "schema": {
              "example": "ve9EPM428h8vShlRW1KT",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetAnalyticsBodyDTOV2"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully retrieved analytics data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatisticsResponseDTO"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "socialplanner/statistics.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": {
      "GetAnalyticsBodyDTOV2": {
        "type": "object",
        "properties": {
          "profileIds": {
            "description": "Array of connected social media account IDs to fetch analytics for. Limited to 100 accounts maximum.",
            "example": [
              "6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366"
            ],
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "platforms": {
            "type": "array",
            "description": "Array of social media platforms to filter analytics by. If not provided, all platforms will be included.",
            "example": [
              "facebook",
              "instagram",
              "linkedin",
              "google",
              "pinterest",
              "youtube",
              "tiktok"
            ],
            "items": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "linkedin",
                "google",
                "pinterest",
                "youtube",
                "tiktok"
              ]
            }
          },
          "currentRange": {
            "description": "Current date range for analytics. If not provided, defaults to the last 7 days (excluding today) with comparison to the previous 7 days.",
            "example": {
              "startDate": "2025-01-01T00:00:00.000Z",
              "endDate": "2025-01-07T23:59:59.999Z"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "startDate": {
                    "type": "string",
                    "description": "Start date (ISO 8601 format)",
                    "example": "2025-01-01T00:00:00.000Z"
                  },
                  "endDate": {
                    "type": "string",
                    "description": "End date (ISO 8601 format)",
                    "example": "2025-01-07T23:59:59.999Z"
                  }
                },
                "required": [
                  "startDate",
                  "endDate"
                ],
                "title": "DateRangeDto"
              }
            ]
          },
          "prevRange": {
            "description": "Comparison date range. If not provided, no comparison will be made.",
            "example": {
              "startDate": "2024-12-25T00:00:00.000Z",
              "endDate": "2024-12-31T23:59:59.999Z"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "startDate": {
                    "type": "string",
                    "description": "Start date (ISO 8601 format)",
                    "example": "2025-01-01T00:00:00.000Z"
                  },
                  "endDate": {
                    "type": "string",
                    "description": "End date (ISO 8601 format)",
                    "example": "2025-01-07T23:59:59.999Z"
                  }
                },
                "required": [
                  "startDate",
                  "endDate"
                ],
                "title": "DateRangeDto"
              }
            ]
          }
        },
        "title": "GetAnalyticsBodyDTOV2"
      },
      "StatisticsResponseDTO": {
        "type": "object",
        "properties": {
          "results": {
            "description": "Analytics data grouped by metrics and platforms for the requested accounts and date range.",
            "example": {
              "dayRange": [
                "Mon",
                "Tue",
                "Wed",
                "Thu",
                "Fri",
                "Sat",
                "Sun"
              ],
              "grouping": "daily",
              "totals": {
                "posts": 0,
                "likes": 0,
                "followers": 0,
                "impressions": 0,
                "comments": 0
              },
              "postPerformance": {
                "posts": {
                  "google": [
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                  ]
                },
                "impressions": [
                  0,
                  0,
                  0,
                  0,
                  0,
                  0,
                  0
                ],
                "likes": [
                  0,
                  0,
                  0,
                  0,
                  0,
                  0,
                  0
                ],
                "comments": [
                  0,
                  0,
                  0,
                  0,
                  0,
                  0,
                  0
                ]
              },
              "breakdowns": {
                "posts": {
                  "total": 0,
                  "totalChange": 0,
                  "platforms": {
                    "google": {
                      "value": 0,
                      "change": 0
                    }
                  }
                },
                "impressions": {
                  "total": 0,
                  "totalChange": 0,
                  "platforms": {
                    "google": {
                      "value": 0,
                      "change": 0
                    }
                  }
                },
                "reach": {
                  "total": 0,
                  "totalChange": 0,
                  "platforms": {
                    "google": {
                      "value": 0,
                      "change": 0
                    }
                  }
                },
                "engagement": {
                  "google": {
                    "likes": 0,
                    "comments": 0,
                    "shares": 0,
                    "change": 0
                  }
                }
              },
              "platformTotals": {
                "impressions": {
                  "google": {
                    "total": 0,
                    "series": [
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0
                    ]
                  }
                },
                "followers": {
                  "google": {
                    "total": 0,
                    "series": [
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0
                    ]
                  }
                },
                "likes": {
                  "google": {
                    "total": 0,
                    "series": [
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0
                    ]
                  }
                }
              },
              "demographics": {
                "gender": {
                  "totals": {
                    "male": {
                      "total": 0,
                      "percentage": 0
                    },
                    "female": {
                      "total": 0,
                      "percentage": 0
                    },
                    "unknown": {
                      "total": 0,
                      "percentage": 0
                    }
                  }
                },
                "age": {
                  "totals": {
                    "13-17": 0,
                    "18-24": 0,
                    "25-34": 0,
                    "35-44": 0,
                    "45-54": 0,
                    "55-64": 0,
                    "65+": 0
                  }
                }
              }
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "dayRange": {
                    "description": "Display label for each time bucket in the period (weekday name for daily grouping, or a date-range label for bidaily/weekly/monthly/yearly grouping).",
                    "example": [
                      "Mon",
                      "Tue",
                      "Wed",
                      "Thu",
                      "Fri",
                      "Sat",
                      "Sun"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "grouping": {
                    "type": "string",
                    "description": "Time-bucket granularity used to build this response, derived from the length of the requested date range (daily up to 10 days, bidaily up to 20 days, weekly up to 60 days, otherwise monthly or yearly).",
                    "enum": [
                      "daily",
                      "bidaily",
                      "weekly",
                      "monthly",
                      "yearly"
                    ],
                    "example": "daily"
                  },
                  "totals": {
                    "description": "Aggregated metric totals for the current period.",
                    "example": {
                      "posts": 0,
                      "likes": 0,
                      "followers": 0,
                      "impressions": 0,
                      "comments": 0
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "posts": {
                            "type": "number",
                            "description": "Total number of posts published across all requested accounts in the period.",
                            "example": 356
                          },
                          "likes": {
                            "type": "number",
                            "description": "Total number of likes received across all requested accounts in the period.",
                            "example": 46
                          },
                          "followers": {
                            "type": "number",
                            "description": "Total number of followers across all requested accounts.",
                            "example": 12000
                          },
                          "impressions": {
                            "type": "number",
                            "description": "Total number of impressions across all posts in the period.",
                            "example": 944
                          },
                          "comments": {
                            "type": "number",
                            "description": "Total number of comments received across all requested accounts in the period.",
                            "example": 11
                          }
                        },
                        "required": [
                          "posts",
                          "likes",
                          "followers",
                          "impressions",
                          "comments"
                        ],
                        "title": "StatisticsTotalsDTO"
                      }
                    ]
                  },
                  "postPerformance": {
                    "description": "Post performance metrics over time, split by platform and by overall daily/bucketed totals.",
                    "example": {
                      "posts": {
                        "google": [
                          0,
                          0,
                          0,
                          0,
                          0,
                          0,
                          0
                        ]
                      },
                      "impressions": [
                        0,
                        0,
                        0,
                        0,
                        0,
                        0,
                        0
                      ],
                      "likes": [
                        0,
                        0,
                        0,
                        0,
                        0,
                        0,
                        0
                      ],
                      "comments": [
                        0,
                        0,
                        0,
                        0,
                        0,
                        0,
                        0
                      ]
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "posts": {
                            "type": "object",
                            "description": "Number of posts published per time bucket, keyed by platform name.",
                            "additionalProperties": {
                              "type": "array",
                              "items": {
                                "type": "number"
                              }
                            },
                            "example": {
                              "instagram": [
                                2,
                                1,
                                3,
                                0,
                                1,
                                2,
                                4
                              ],
                              "facebook": [
                                1,
                                0,
                                2,
                                1,
                                0,
                                1,
                                1
                              ]
                            }
                          },
                          "impressions": {
                            "description": "Total impressions per time bucket, summed across all platforms.",
                            "example": [
                              0,
                              0,
                              0,
                              0,
                              0,
                              0,
                              0
                            ],
                            "type": "array",
                            "items": {
                              "type": "number"
                            }
                          },
                          "likes": {
                            "description": "Total likes per time bucket, summed across all platforms.",
                            "example": [
                              0,
                              0,
                              0,
                              0,
                              0,
                              0,
                              0
                            ],
                            "type": "array",
                            "items": {
                              "type": "number"
                            }
                          },
                          "comments": {
                            "description": "Total comments per time bucket, summed across all platforms.",
                            "example": [
                              0,
                              0,
                              0,
                              0,
                              0,
                              0,
                              0
                            ],
                            "type": "array",
                            "items": {
                              "type": "number"
                            }
                          }
                        },
                        "required": [
                          "posts",
                          "impressions",
                          "likes",
                          "comments"
                        ],
                        "title": "StatisticsPostPerformanceDTO"
                      }
                    ]
                  },
                  "breakdowns": {
                    "description": "Detailed breakdowns by metric (posts, impressions, reach, engagement) and platform, including percentage change versus the comparison period.",
                    "example": {
                      "posts": {
                        "total": 0,
                        "totalChange": 0,
                        "platforms": {
                          "google": {
                            "value": 0,
                            "change": 0
                          }
                        }
                      },
                      "impressions": {
                        "total": 0,
                        "totalChange": 0,
                        "platforms": {
                          "google": {
                            "value": 0,
                            "change": 0
                          }
                        }
                      },
                      "reach": {
                        "total": 0,
                        "totalChange": 0,
                        "platforms": {
                          "google": {
                            "value": 0,
                            "change": 0
                          }
                        }
                      },
                      "engagement": {
                        "google": {
                          "likes": 0,
                          "comments": 0,
                          "shares": 0,
                          "change": 0
                        }
                      }
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "posts": {
                            "description": "Post count breakdown by platform.",
                            "example": {
                              "total": 356,
                              "totalChange": -39.35,
                              "platforms": {
                                "instagram": {
                                  "value": 46,
                                  "change": -71.95
                                }
                              }
                            },
                            "allOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "total": {
                                    "type": "number",
                                    "description": "Total value for this metric across all platforms.",
                                    "example": 356
                                  },
                                  "totalChange": {
                                    "type": "number",
                                    "description": "Percentage change in the total versus the previous comparison period.",
                                    "example": -39.35
                                  },
                                  "platforms": {
                                    "type": "object",
                                    "description": "Per-platform value and percentage change, keyed by platform name.",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "value": {
                                          "type": "number",
                                          "description": "Metric value for this platform in the current period.",
                                          "example": 46
                                        },
                                        "change": {
                                          "type": "number",
                                          "description": "Percentage change versus the previous comparison period. 0 when there is no previous period or the previous value was 0.",
                                          "example": -71.95
                                        }
                                      },
                                      "required": [
                                        "value",
                                        "change"
                                      ],
                                      "title": "StatisticsPlatformValueChangeDTO"
                                    },
                                    "example": {
                                      "instagram": {
                                        "value": 46,
                                        "change": -71.95
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "total",
                                  "totalChange",
                                  "platforms"
                                ],
                                "title": "StatisticsMetricBreakdownDTO"
                              }
                            ]
                          },
                          "impressions": {
                            "description": "Impressions breakdown by platform.",
                            "example": {
                              "total": 944,
                              "totalChange": -49.68,
                              "platforms": {
                                "instagram": {
                                  "value": 239,
                                  "change": 83.85
                                }
                              }
                            },
                            "allOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "total": {
                                    "type": "number",
                                    "description": "Total value for this metric across all platforms.",
                                    "example": 356
                                  },
                                  "totalChange": {
                                    "type": "number",
                                    "description": "Percentage change in the total versus the previous comparison period.",
                                    "example": -39.35
                                  },
                                  "platforms": {
                                    "type": "object",
                                    "description": "Per-platform value and percentage change, keyed by platform name.",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "value": {
                                          "type": "number",
                                          "description": "Metric value for this platform in the current period.",
                                          "example": 46
                                        },
                                        "change": {
                                          "type": "number",
                                          "description": "Percentage change versus the previous comparison period. 0 when there is no previous period or the previous value was 0.",
                                          "example": -71.95
                                        }
                                      },
                                      "required": [
                                        "value",
                                        "change"
                                      ],
                                      "title": "StatisticsPlatformValueChangeDTO"
                                    },
                                    "example": {
                                      "instagram": {
                                        "value": 46,
                                        "change": -71.95
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "total",
                                  "totalChange",
                                  "platforms"
                                ],
                                "title": "StatisticsMetricBreakdownDTO"
                              }
                            ]
                          },
                          "reach": {
                            "description": "Reach breakdown by platform.",
                            "example": {
                              "total": 354,
                              "totalChange": 98.88,
                              "platforms": {
                                "instagram": {
                                  "value": 233,
                                  "change": 128.43
                                }
                              }
                            },
                            "allOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "total": {
                                    "type": "number",
                                    "description": "Total value for this metric across all platforms.",
                                    "example": 356
                                  },
                                  "totalChange": {
                                    "type": "number",
                                    "description": "Percentage change in the total versus the previous comparison period.",
                                    "example": -39.35
                                  },
                                  "platforms": {
                                    "type": "object",
                                    "description": "Per-platform value and percentage change, keyed by platform name.",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "value": {
                                          "type": "number",
                                          "description": "Metric value for this platform in the current period.",
                                          "example": 46
                                        },
                                        "change": {
                                          "type": "number",
                                          "description": "Percentage change versus the previous comparison period. 0 when there is no previous period or the previous value was 0.",
                                          "example": -71.95
                                        }
                                      },
                                      "required": [
                                        "value",
                                        "change"
                                      ],
                                      "title": "StatisticsPlatformValueChangeDTO"
                                    },
                                    "example": {
                                      "instagram": {
                                        "value": 46,
                                        "change": -71.95
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "total",
                                  "totalChange",
                                  "platforms"
                                ],
                                "title": "StatisticsMetricBreakdownDTO"
                              }
                            ]
                          },
                          "engagement": {
                            "type": "object",
                            "description": "Engagement metrics (likes, comments, shares, change), keyed by platform name.",
                            "additionalProperties": {
                              "type": "object",
                              "properties": {
                                "likes": {
                                  "type": "number",
                                  "description": "Number of likes received on this platform.",
                                  "example": 0
                                },
                                "comments": {
                                  "type": "number",
                                  "description": "Number of comments received on this platform.",
                                  "example": 11
                                },
                                "shares": {
                                  "type": "number",
                                  "description": "Number of shares on this platform.",
                                  "example": 0
                                },
                                "change": {
                                  "type": "number",
                                  "description": "Percentage change in total engagement (likes + comments + shares) versus the previous period.",
                                  "example": -66.67
                                }
                              },
                              "required": [
                                "likes",
                                "comments",
                                "shares",
                                "change"
                              ],
                              "title": "StatisticsEngagementPlatformDTO"
                            },
                            "example": {
                              "instagram": {
                                "likes": 0,
                                "comments": 11,
                                "shares": 0,
                                "change": -66.67
                              }
                            }
                          }
                        },
                        "required": [
                          "posts",
                          "impressions",
                          "reach",
                          "engagement"
                        ],
                        "title": "StatisticsBreakdownsDTO"
                      }
                    ]
                  },
                  "platformTotals": {
                    "description": "Platform-wise totals with per-time-bucket series data for impressions, followers and likes.",
                    "example": {
                      "impressions": {
                        "google": {
                          "total": 0,
                          "series": [
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0
                          ]
                        }
                      },
                      "followers": {
                        "google": {
                          "total": 0,
                          "series": [
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0
                          ]
                        }
                      },
                      "likes": {
                        "google": {
                          "total": 0,
                          "series": [
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0
                          ]
                        }
                      }
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "impressions": {
                            "type": "object",
                            "description": "Daily impression totals and series, keyed by platform name.",
                            "additionalProperties": {
                              "type": "object",
                              "properties": {
                                "total": {
                                  "type": "number",
                                  "description": "Total value for this platform across the whole period.",
                                  "example": 239
                                },
                                "series": {
                                  "description": "Per-time-bucket values for this platform, aligned index-for-index with results.dayRange.",
                                  "example": [
                                    22,
                                    6,
                                    4,
                                    69,
                                    138,
                                    0,
                                    0
                                  ],
                                  "type": "array",
                                  "items": {
                                    "type": "number"
                                  }
                                }
                              },
                              "required": [
                                "total",
                                "series"
                              ],
                              "title": "StatisticsPlatformSeriesDTO"
                            },
                            "example": {
                              "instagram": {
                                "total": 239,
                                "series": [
                                  22,
                                  6,
                                  4,
                                  69,
                                  138,
                                  0,
                                  0
                                ]
                              }
                            }
                          },
                          "followers": {
                            "type": "object",
                            "description": "Daily follower totals and series, keyed by platform name.",
                            "additionalProperties": {
                              "type": "object",
                              "properties": {
                                "total": {
                                  "type": "number",
                                  "description": "Total value for this platform across the whole period.",
                                  "example": 239
                                },
                                "series": {
                                  "description": "Per-time-bucket values for this platform, aligned index-for-index with results.dayRange.",
                                  "example": [
                                    22,
                                    6,
                                    4,
                                    69,
                                    138,
                                    0,
                                    0
                                  ],
                                  "type": "array",
                                  "items": {
                                    "type": "number"
                                  }
                                }
                              },
                              "required": [
                                "total",
                                "series"
                              ],
                              "title": "StatisticsPlatformSeriesDTO"
                            },
                            "example": {
                              "instagram": {
                                "total": 0,
                                "series": [
                                  0,
                                  0,
                                  0,
                                  0,
                                  0,
                                  0,
                                  0
                                ]
                              }
                            }
                          },
                          "likes": {
                            "type": "object",
                            "description": "Daily like totals and series, keyed by platform name.",
                            "additionalProperties": {
                              "type": "object",
                              "properties": {
                                "total": {
                                  "type": "number",
                                  "description": "Total value for this platform across the whole period.",
                                  "example": 239
                                },
                                "series": {
                                  "description": "Per-time-bucket values for this platform, aligned index-for-index with results.dayRange.",
                                  "example": [
                                    22,
                                    6,
                                    4,
                                    69,
                                    138,
                                    0,
                                    0
                                  ],
                                  "type": "array",
                                  "items": {
                                    "type": "number"
                                  }
                                }
                              },
                              "required": [
                                "total",
                                "series"
                              ],
                              "title": "StatisticsPlatformSeriesDTO"
                            },
                            "example": {
                              "linkedin": {
                                "total": 1,
                                "series": [
                                  0,
                                  0,
                                  0,
                                  1,
                                  0,
                                  0,
                                  0
                                ]
                              }
                            }
                          }
                        },
                        "required": [
                          "impressions",
                          "followers",
                          "likes"
                        ],
                        "title": "StatisticsPlatformTotalsDTO"
                      }
                    ]
                  },
                  "demographics": {
                    "description": "Audience demographic breakdown by gender and age. Currently only populated for Instagram accounts.",
                    "example": {
                      "gender": {
                        "totals": {
                          "male": {
                            "total": 0,
                            "percentage": 0
                          },
                          "female": {
                            "total": 0,
                            "percentage": 0
                          },
                          "unknown": {
                            "total": 0,
                            "percentage": 0
                          }
                        }
                      },
                      "age": {
                        "totals": {
                          "13-17": 0,
                          "18-24": 0,
                          "25-34": 0,
                          "35-44": 0,
                          "45-54": 0,
                          "55-64": 0,
                          "65+": 0
                        }
                      }
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "gender": {
                            "description": "Gender distribution of the audience. Currently only populated from Instagram accounts.",
                            "example": {
                              "totals": {
                                "male": {
                                  "total": 0,
                                  "percentage": 0
                                },
                                "female": {
                                  "total": 0,
                                  "percentage": 0
                                },
                                "unknown": {
                                  "total": 0,
                                  "percentage": 0
                                }
                              }
                            },
                            "allOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "totals": {
                                    "description": "Total counts and percentages by gender.",
                                    "example": {
                                      "male": {
                                        "total": 0,
                                        "percentage": 0
                                      },
                                      "female": {
                                        "total": 0,
                                        "percentage": 0
                                      },
                                      "unknown": {
                                        "total": 0,
                                        "percentage": 0
                                      }
                                    },
                                    "allOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "male": {
                                            "description": "Male audience statistics.",
                                            "example": {
                                              "total": 0,
                                              "percentage": 0
                                            },
                                            "allOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "total": {
                                                    "type": "number",
                                                    "description": "Total number of audience members in this gender bucket.",
                                                    "example": 0
                                                  },
                                                  "percentage": {
                                                    "type": "number",
                                                    "description": "Percentage of the total audience this gender bucket represents.",
                                                    "example": 0
                                                  }
                                                },
                                                "required": [
                                                  "total",
                                                  "percentage"
                                                ],
                                                "title": "StatisticsGenderStatDTO"
                                              }
                                            ]
                                          },
                                          "female": {
                                            "description": "Female audience statistics.",
                                            "example": {
                                              "total": 0,
                                              "percentage": 0
                                            },
                                            "allOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "total": {
                                                    "type": "number",
                                                    "description": "Total number of audience members in this gender bucket.",
                                                    "example": 0
                                                  },
                                                  "percentage": {
                                                    "type": "number",
                                                    "description": "Percentage of the total audience this gender bucket represents.",
                                                    "example": 0
                                                  }
                                                },
                                                "required": [
                                                  "total",
                                                  "percentage"
                                                ],
                                                "title": "StatisticsGenderStatDTO"
                                              }
                                            ]
                                          },
                                          "unknown": {
                                            "description": "Audience statistics for followers with unspecified gender.",
                                            "example": {
                                              "total": 0,
                                              "percentage": 0
                                            },
                                            "allOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "total": {
                                                    "type": "number",
                                                    "description": "Total number of audience members in this gender bucket.",
                                                    "example": 0
                                                  },
                                                  "percentage": {
                                                    "type": "number",
                                                    "description": "Percentage of the total audience this gender bucket represents.",
                                                    "example": 0
                                                  }
                                                },
                                                "required": [
                                                  "total",
                                                  "percentage"
                                                ],
                                                "title": "StatisticsGenderStatDTO"
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "male",
                                          "female",
                                          "unknown"
                                        ],
                                        "title": "StatisticsGenderTotalsDTO"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "totals"
                                ],
                                "title": "StatisticsGenderDemographicsDTO"
                              }
                            ]
                          },
                          "age": {
                            "description": "Age distribution of the audience. Currently only populated from Instagram accounts.",
                            "example": {
                              "totals": {
                                "13-17": 0,
                                "18-24": 0,
                                "25-34": 0,
                                "35-44": 0,
                                "45-54": 0,
                                "55-64": 0,
                                "65+": 0
                              }
                            },
                            "allOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "totals": {
                                    "type": "object",
                                    "description": "Total audience count per age group, keyed by age range. Keys are `13-17`, `18-24`, `25-34`, `35-44`, `45-54`, `55-64` and `65+`.",
                                    "additionalProperties": {
                                      "type": "number"
                                    },
                                    "example": {
                                      "13-17": 0,
                                      "18-24": 0,
                                      "25-34": 0,
                                      "35-44": 0,
                                      "45-54": 0,
                                      "55-64": 0,
                                      "65+": 0
                                    }
                                  }
                                },
                                "required": [
                                  "totals"
                                ],
                                "title": "StatisticsAgeDemographicsDTO"
                              }
                            ]
                          }
                        },
                        "required": [
                          "gender",
                          "age"
                        ],
                        "title": "StatisticsDemographicsDTO"
                      }
                    ]
                  }
                },
                "required": [
                  "dayRange",
                  "grouping",
                  "totals",
                  "postPerformance",
                  "breakdowns",
                  "platformTotals",
                  "demographics"
                ],
                "title": "StatisticsResultsDTO"
              }
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable status message confirming the analytics were built successfully.",
            "example": "Analytics Built Successfully"
          },
          "traceId": {
            "type": "string",
            "description": "Trace ID for debugging",
            "example": "42fc8dd8-d55b-475f-944f-9efb90d77564"
          }
        },
        "required": [
          "results",
          "message",
          "traceId"
        ],
        "title": "StatisticsResponseDTO"
      },
      "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"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/social-media-posting/statistics?locationId=<LOCATIONID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "profileIds": [
    "6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366"
  ],
  "platforms": [
    "facebook",
    "instagram",
    "linkedin",
    "google",
    "pinterest",
    "youtube",
    "tiktok"
  ],
  "currentRange": {
    "startDate": "2025-01-01T00:00:00.000Z",
    "endDate": "2025-01-07T23:59:59.999Z"
  },
  "prevRange": {
    "startDate": "2024-12-25T00:00:00.000Z",
    "endDate": "2024-12-31T23:59:59.999Z"
  }
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "profileIds": [
        "6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366"
      ],
      "platforms": [
        "facebook",
        "instagram",
        "linkedin",
        "google",
        "pinterest",
        "youtube",
        "tiktok"
      ],
      "currentRange": {
        "startDate": "2025-01-01T00:00:00.000Z",
        "endDate": "2025-01-07T23:59:59.999Z"
      },
      "prevRange": {
        "startDate": "2024-12-25T00:00:00.000Z",
        "endDate": "2024-12-31T23:59:59.999Z"
      }
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/social-media-posting/statistics?locationId=<LOCATIONID>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/social-media-posting/statistics"

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

params = {
    "locationId": "<LOCATIONID>"
}

payload = {
    "profileIds": [
        "6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366"
    ],
    "platforms": [
        "facebook",
        "instagram",
        "linkedin",
        "google",
        "pinterest",
        "youtube",
        "tiktok"
    ],
    "currentRange": {
        "startDate": "2025-01-01T00:00:00.000Z",
        "endDate": "2025-01-07T23:59:59.999Z"
    },
    "prevRange": {
        "startDate": "2024-12-25T00:00:00.000Z",
        "endDate": "2024-12-31T23:59:59.999Z"
    }
}

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

**PHP**

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

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/social-media-posting/statistics?locationId=<LOCATIONID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "profileIds": [
    "6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366"
  ],
  "platforms": [
    "facebook",
    "instagram",
    "linkedin",
    "google",
    "pinterest",
    "youtube",
    "tiktok"
  ],
  "currentRange": {
    "startDate": "2025-01-01T00:00:00.000Z",
    "endDate": "2025-01-07T23:59:59.999Z"
  },
  "prevRange": {
    "startDate": "2024-12-25T00:00:00.000Z",
    "endDate": "2024-12-31T23:59:59.999Z"
  }
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/social-media-posting/statistics?locationId=<LOCATIONID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"profileIds\":[\"6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366\"],\"platforms\":[\"facebook\",\"instagram\",\"linkedin\",\"google\",\"pinterest\",\"youtube\",\"tiktok\"],\"currentRange\":{\"startDate\":\"2025-01-01T00:00:00.000Z\",\"endDate\":\"2025-01-07T23:59:59.999Z\"},\"prevRange\":{\"startDate\":\"2024-12-25T00:00:00.000Z\",\"endDate\":\"2024-12-31T23:59:59.999Z\"}}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/social-media-posting/statistics?locationId=<LOCATIONID>"
  payload := strings.NewReader(`{
  "profileIds": [
    "6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366"
  ],
  "platforms": [
    "facebook",
    "instagram",
    "linkedin",
    "google",
    "pinterest",
    "youtube",
    "tiktok"
  ],
  "currentRange": {
    "startDate": "2025-01-01T00:00:00.000Z",
    "endDate": "2025-01-07T23:59:59.999Z"
  },
  "prevRange": {
    "startDate": "2024-12-25T00:00:00.000Z",
    "endDate": "2024-12-31T23:59:59.999Z"
  }
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  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/social-media-posting/statistics?locationId=<LOCATIONID>")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "profileIds": [
    "6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366"
  ],
  "platforms": [
    "facebook",
    "instagram",
    "linkedin",
    "google",
    "pinterest",
    "youtube",
    "tiktok"
  ],
  "currentRange": {
    "startDate": "2025-01-01T00:00:00.000Z",
    "endDate": "2025-01-07T23:59:59.999Z"
  },
  "prevRange": {
    "startDate": "2024-12-25T00:00:00.000Z",
    "endDate": "2024-12-31T23:59:59.999Z"
  }
}'

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

**PowerShell**

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

$body = '{
  "profileIds": [
    "6673d4f770801753dcafd7b8_SovchenxzWl9R3OFPgsj_9285776684082983366"
  ],
  "platforms": [
    "facebook",
    "instagram",
    "linkedin",
    "google",
    "pinterest",
    "youtube",
    "tiktok"
  ],
  "currentRange": {
    "startDate": "2025-01-01T00:00:00.000Z",
    "endDate": "2025-01-07T23:59:59.999Z"
  },
  "prevRange": {
    "startDate": "2024-12-25T00:00:00.000Z",
    "endDate": "2024-12-31T23:59:59.999Z"
  }
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/social-media-posting/statistics?locationId=<LOCATIONID>' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
