How do I get the bins from a purchase order line item from the Business Central APIs?

Trevor Leon 25 Reputation points
2025-12-04T21:24:59.9433333+00:00

I have a C# app that calls Business Central APIs. I can use https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/Sandbox/api/v2.0/companies({{company_id}})/purchaseOrders({{PO}})/purchaseOrderLines?$expand=location to get more data about the purchase order lines and the locations, but it doesn't give the bin code. I've looked everywhere and asked Copilot, but I can't seem to find more information on this.

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-04T21:45:17.2166667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To obtain bin information for a purchase order line item in Business Central using APIs, you will need to follow these steps:

    1. Retrieve Purchase Order Lines: Use your existing API call to get the purchase order lines along with their associated location details. This is done using the endpoint you mentioned: GET /api/v2.0/companies({company_id})/purchaseOrders({PO})/purchaseOrderLines?$expand=location.
    2. Access Location Details: After retrieving the location information, you will need to check if there is a specific API endpoint available that allows you to retrieve bin information for that location. Typically, bins are linked to locations, and you may need to query the bins associated with the location separately.
    3. Check for Bins API: Look for an API endpoint that provides bin details for the specified location. This could be something like GET /api/v2.0/companies({company_id})/locations({locationId})/bins, depending on the version of the Business Central API you are using.

    If the bin codes are not returned in your current API call, you may need to explore the Business Central documentation for any additional endpoints or updates that could provide the bin information you are looking for.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.