Description
What is field expansion?
Field expansion is the Graph API feature that lets a read request name the exact properties it wants back. Instead of accepting a node's default set of fields, you add a fields query parameter — GET /{PHONE_NUMBER_ID}?fields=display_phone_number,quality_rating,health_status — and the response contains just those fields plus the object's id. It works on the nodes the WhatsApp Cloud API and the WhatsApp Business Management API expose, from a business phone number to a WhatsApp Business Account (WABA) and its message templates.
The "expansion" part is nesting. An edge — a connection to a list of other objects, such as a WABA's phone_numbers or message_templates — can be named inside fields with its own field list in curly braces: fields=name,phone_numbers{display_phone_number,verified_name,quality_rating}. Modifiers attach to the edge name: .limit(5) caps the items returned per page and .after(cursor) continues from a cursor. Nesting can go several levels deep, so one request can replace a chain of dependent calls.
Field expansion is often confused with Cursor-Based Pagination. Expansion controls which properties each object carries; pagination controls how many objects of an edge come back and how you fetch the next page. The two combine: an expanded edge still returns a data array and a paging object with before and after cursors. It is also different from Graph API Batch Requests, which bundle several separate calls into one HTTP request rather than shaping the response of a single call.
Key takeaways
- Field expansion is the
fieldsquery parameter that tells a Graph API GET exactly which properties and nested edges to return. - Nest an edge's fields in braces —
phone_numbers{display_phone_number,quality_rating}— to read a WABA and its numbers in one call. - Add
.limit(n)to an edge insidefieldsto cap how many items come back per page; paging cursors still apply. - One unknown or misspelled field name fails the whole request with error 100, so keep field lists in tested constants.
- Field expansion shapes what each object contains; pagination decides how many objects you get back.
Usage
Field expansion in code
# A phone number: only the fields you needcurl -G "https://graph.facebook.com/v26.0/{PHONE_NUMBER_ID}" \-H "Authorization: Bearer {ACCESS_TOKEN}" \--data-urlencode "fields=display_phone_number,verified_name,quality_rating,health_status"# A WABA and its numbers in one call (nested edge + limit)curl -G "https://graph.facebook.com/v26.0/{WABA_ID}" \-H "Authorization: Bearer {ACCESS_TOKEN}" \--data-urlencode "fields=name,currency,phone_numbers.limit(10){display_phone_number,quality_rating}"
-G with --data-urlencode puts the encoded fields value on the query string, so curl never tries to expand the braces.
Mechanics
How does field expansion work?
step 1 — Start from the node
Pick the object you are reading — a phone number ID, a WABA ID, a template ID — and call it with GET. Without
fields, the Graph API returns that node's default set of fields.step 2 — List the fields you need
Add
fields=with comma-separated names and no spaces, e.g.fields=display_phone_number,quality_rating,name_status. The response holds those fields plusid, which is always returned.step 3 — Expand an edge with braces
Name an edge and put its fields in curly braces:
phone_numbers{display_phone_number,quality_rating}. Each expanded edge comes back as an object with adataarray andpagingcursors.step 4 — Attach modifiers to the edge
Add
.limit(n)to cap items per page and.after(cursor)to continue a page inside the expansion, e.g.message_templates.limit(20){name,status,category}.step 5 — URL-encode the value
Braces, commas and parentheses must survive the trip. Encode the
fieldsvalue —curl -G --data-urlencode, orURLSearchParamsin code — instead of pasting raw braces into a shell.
Properties
Field expansion: key facts and limits
- Parameter
- fields — comma-separated, no spaces
- Nested edge syntax
- edge{field,field}
- Edge modifiers
- .limit(n), .after(cursor), .as(alias) where supported
- Always returned
- id, even when not requested
- Expanded edge shape
- { data: [...], paging: { cursors } }
- Unknown field
- Error 100 — the whole request fails
- Nesting depth
- No documented limit; very large trees can be rejected
Why it matters
Why does field expansion matter?
Most WhatsApp management reads — a dashboard of number quality, a list of template statuses, an onboarding check after Embedded Signup — need a handful of fields from many objects. Asking for exactly those fields keeps responses small, cuts round trips (one expanded call instead of one per phone number) and makes your code explicit about what it depends on, so a change to a node's default fields does not silently change your data. It is also the only way to get fields that are not in the default response, such as health_status, which appears only when you request it.
Caveats
Common mistakes with field expansion
Pasting raw braces into a shell
Shells and curl's URL globbing treat
{}specially, so the request goes out malformed or not at all. Usecurl -G --data-urlencode,curl -g, or build the query withURLSearchParams.Misspelling one field
A single unknown name fails the entire call with Error 100 (Invalid Parameter) — "Tried accessing nonexisting field…" — not just that field. Keep field lists in constants and cover them in an integration test against a test number.
Expanding everything
Very wide or deep trees make slow responses, and the Graph API can reject them with an error asking you to reduce the amount of data requested. Expand only what the screen or job uses and page large edges with
.limit().Treating expansion as pagination
.limit(100)on an expanded edge still returns one page. Ifpaginghas anaftercursor or anextlink, there are more items — follow it rather than assuming the first page is complete.
Example
Example: One call for a multi-number dashboard
A Chennai logistics company runs six WhatsApp numbers, one per regional hub, under a single WABA. Its ops dashboard used to list the numbers with GET /{WABA_ID}/phone_numbers and then make one GET per number for its quality rating — seven calls on every refresh. With field expansion it makes one: GET /{WABA_ID}?fields=name,phone_numbers{display_phone_number,verified_name,quality_rating}. The response lists all six numbers with only the three properties the dashboard renders, and when the Coimbatore number drops to YELLOW the change shows on the next refresh. The team then calls health_status only on numbers that look unhealthy.
Notes
Best practices for field expansion
- Keep each job's field list in one named constant so a code review shows exactly what it reads.
- Request
health_statusexplicitly — the Health Status API is just this field, and it is only returned when you ask for it. - Use the Graph API Explorer's field picker to discover valid field names before writing code.
- Log the
fieldsstring with each failed call; error 100 messages name the field that broke it.
Questions
Field Expansion FAQs
- What does the fields parameter do in the Graph API?
- It limits the response to the properties you name. Without it, a node returns its default fields; with
fields=a,b,cyou get just those plusid, and braces let you expand edges to read related objects in the same call. - How do I get nested fields in one Graph API call?
- Put the edge's fields in curly braces inside
fields. On a WABA,fields=name,phone_numbers{display_phone_number,quality_rating}returns the account name and every number's display number and rating; add.limit(n)to the edge to cap items per page. - Does field expansion reduce rate-limit usage?
- It reduces the number of calls, which is what Graph rate limits mainly count. One expanded request replaces several dependent ones, but some limits also weigh processing time, so a huge expansion is not free of cost — expand only what you use.
- What is the difference between field expansion and pagination?
- Field expansion chooses which properties each object returns; pagination chooses how many objects of an edge you get and how to fetch the next page. An expanded edge is still paginated, with
pagingcursors you follow for more items.