REFERENCE / META
API basics / 15 min

Query the Meta Graph API

Build a small read-only request, choose fields, and follow pagination safely.

The shape of a request

Every Graph API request needs four things:

1VersionvCURRENT_VERSION
+
2ObjectAd account, campaign, page
+
3FieldsOnly what you need
+
4TokenSent as a Bearer header

Make one small request

This example lists campaign names and statuses. Replace the version and account ID with current values from your Meta setup.

curl -G "https://graph.facebook.com/vCURRENT_VERSION/act_AD_ACCOUNT_ID/campaigns" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  --data-urlencode "fields=id,name,status" \
  --data-urlencode "limit=25"

Start with read-only fields. In n8n, keep the token in a credential and build the URL without it.

Read the response

Useful records arrive in data. If more records exist, paging.next points to the next page and paging.cursors.after gives you a cursor. Continue until there is no next page. Do not assume the first page is the full result.

Common errors

  • Invalid OAuth access token: the token is wrong, expired, revoked, or belongs to another app.
  • Unsupported get request: the object ID is wrong or the user/token cannot see it.
  • Permissions error: the token is valid but lacks the needed permission or asset access.
  • Rate limit: slow the workflow, fetch fewer fields, cache stable results, and retry with a delay.

A safe first test

Use Meta’s Graph API Explorer or an HTTP client to read one object you already know. Ask for two or three fields, not fields=*. Save the exact API version in the workflow and review Meta’s version schedule before upgrading it.

Official references: Graph API overview, using the Graph API, and Marketing API reference.