API v2 lacks documented expand parameter support despite design intent.
The issue reports that API v2 ignores the expand parameter for Link fields, which should return expanded objects instead of strings. The fix requires modifying the API response handling but needs maintainer confirmation on expected behavior. No technical blockers exist beyond design alignment.
API v2 does not handle the expand query parameter when fetching documents.
Passing expand is currently ignored, and Link fields are always returned as plain strings instead of expanded objects. This limits API v2 usability and is inconsistent with the intended design discussed for API v2.
Output of bench version
Frappe Framework: v15.x.x
ERPNext: v15.x.x
Send a request to API v2 document endpoint with expand parameter:
GET /api/v2/document/Sales Order/SO-0001?expand=["customer"]
Ensure the document contains a valid Link field value (e.g. customer = "CUST-0001")
Check the response
The expand parameter is ignored and the Link field is returned as a string:
{
"name": "SO-0001",
"customer": "CUST-0001"
}
Expected result
When expand is provided, Link fields should be expanded into objects:
{
"name": "SO-0001",
"customer": {
"name": "CUST-0001",
"customer_name": "Test Customer"
}
}
Stacktrace / full error message
N/A – no error is thrown
Additional information
This is a known missing feature in API v2 discussions. Supporting expand would reduce extra API calls for integrations. I am willing to submit a PR once the expected response structure is confirmed.
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!