ChatFood API

Register a conversion pixel

Needs a token with pixels:write.

curl -s -X POST "$API/v1/meta/datasets?accountId=<account id>" -H "Authorization: Bearer $CF" -H "Content-Type: application/json" -d '{
  "name": "Main pixel",
  "metaDatasetId": "123456789012345",
  "accessToken": "<Conversions API token from Meta Events Manager>",
  "websiteEventName": "Lead",
  "messagingEventName": "LeadSubmitted",
  "isActive": true,
  "appliesToAllPages": true
}'
curl -s "$API/v1/meta/datasets?accountId=<account id>" -H "Authorization: Bearer $CF"

To cover only some niches, send "appliesToAllPages": false and "categoryIds": [...] from GET /v1/categories (account:read).

How pixels are applied

An account registers Meta datasets (pixel plus Conversions API) that receive its attributed conversions. Each dataset covers every page of the account (appliesToAllPages: true) or only the pages of some categories (categoryIds, from GET /v1/categories, scope account:read). The Conversions API token is write only: responses expose hasAccessToken, never the value.

Method Path Body or query Notes
GET /v1/meta/datasets?accountId= limit, cursor, sort (name, createdAt) {"items": [{"id", "accountId", "name", "metaDatasetId", "hasAccessToken", "testEventCode", "websiteEventName", "messagingEventName", "isActive", "appliesToAllPages", "categoryIds", "createdAt", "updatedAt"}], "nextCursor"}.
POST /v1/meta/datasets?accountId= {"name", "metaDatasetId", "accessToken", "testEventCode"?, "websiteEventName"?, "messagingEventName"?, "isActive": true, "appliesToAllPages", "categoryIds"?} 201 with the dataset. id is ChatFood's GUID; metaDatasetId is the dataset id at Meta.
GET /v1/meta/datasets/{datasetId}?accountId= One dataset. 404 for a dataset of another account.
PATCH /v1/meta/datasets/{datasetId}?accountId= any of the fields above; accessToken omitted keeps the stored one; null clears testEventCode and resets the event names to the default; appliesToAllPages and categoryIds change the coverage 200 with the dataset.
DELETE /v1/meta/datasets/{datasetId}?accountId= 204.

Validation (400 problem+json): name 1..100 chars; metaDatasetId digits only, up to 32; accessToken required on create, one token without spaces, up to 1024; testEventCode letters and digits, up to 32; websiteEventName one of Lead (default), CompleteRegistration, Contact, Schedule, SubmitApplication, ViewContent, FindLocation, Search; messagingEventName one of LeadSubmitted (default), QualifiedLead, ViewContent, InitiateCheckout, AddToCart, RatingProvided, ReviewProvided; appliesToAllPages: true requires empty categoryIds, false requires at least one. An accountId outside the credential answers 403.