fb_campaign_insights
Pack: facebook_ads · Endpoint: https://gateway.pipeworx.io/facebook_ads/mcp
Get campaign performance metrics: impressions, clicks, spend, CTR, CPC, conversions, ROAS. Requires account_id and campaign_id.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
campaign_id | string | yes | Campaign ID |
date_preset | string | no | Date preset (e.g., “today”, “yesterday”, “last_7d”, “last_30d”, “this_month”) |
time_range_since | string | no | Start date YYYY-MM-DD (use instead of date_preset) |
time_range_until | string | no | End date YYYY-MM-DD (use with time_range_since) |
fields | string | no | Comma-separated metrics (default: “impressions,clicks,spend,ctr,cpc,cpm,reach,actions”) |
Example call
Arguments
{
"campaign_id": "120393847102340",
"date_preset": "last_7d"
}
curl
curl -X POST https://gateway.pipeworx.io/facebook_ads/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"fb_campaign_insights","arguments":{"campaign_id":"120393847102340","date_preset":"last_7d"}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('fb_campaign_insights', {
"campaign_id": "120393847102340",
"date_preset": "last_7d"
});
More examples
{
"campaign_id": "120393847102340",
"time_range_since": "2024-01-01",
"time_range_until": "2024-01-31",
"fields": "impressions,clicks,spend,ctr,cpc,cpm,reach,actions,action_values"
}
Response shape
| Field | Type | Description |
|---|---|---|
data | array | Performance metrics rows |
paging | object | Pagination info |
error | string | Error code if connection failed |
message | string | Error message if connection failed |
Full JSON Schema
{
"type": "object",
"properties": {
"data": {
"type": "array",
"description": "Performance metrics rows",
"items": {
"type": "object",
"properties": {
"impressions": {
"type": "string",
"description": "Total impressions"
},
"clicks": {
"type": "string",
"description": "Total clicks"
},
"spend": {
"type": "string",
"description": "Total spend in account currency"
},
"ctr": {
"type": "string",
"description": "Click-through rate percentage"
},
"cpc": {
"type": "string",
"description": "Cost per click"
},
"cpm": {
"type": "string",
"description": "Cost per thousand impressions"
},
"reach": {
"type": "string",
"description": "Unique people reached"
},
"actions": {
"type": "array",
"description": "Action breakdowns"
},
"date_start": {
"type": "string",
"description": "Start date YYYY-MM-DD"
},
"date_stop": {
"type": "string",
"description": "End date YYYY-MM-DD"
}
}
}
},
"paging": {
"type": "object",
"description": "Pagination info",
"properties": {
"cursors": {
"type": "object"
},
"next": {
"type": "string"
}
}
},
"error": {
"type": "string",
"description": "Error code if connection failed"
},
"message": {
"type": "string",
"description": "Error message if connection failed"
}
}
}
Connect
Add this to your MCP client config, or use one-click install buttons:
{
"mcpServers": {
"facebook_ads": {
"url": "https://gateway.pipeworx.io/facebook_ads/mcp"
}
}
}
See Getting Started for client-specific install steps.