web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Bussiness Central API v2 Create Customer Posting Group Error

(3) ShareShare
ReportReport
Posted on by

I am unable to create a new customer through the business central api :

 https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_customer_create

Providing the following request body:

{
    "number": "TCUST",
    "displayName": "Test Customer"
}
     

results in the following error:  

{
    "error": {
        "interface": "error-object",
        "main": {
            "status": 500,
            "msg": "The field Gen. Bus. Posting Group of table Customer contains a value (DOMESTIC) that cannot be found in the related table (Gen. Business Posting Group).  ",
            "db": false,
            "title": "msbcbase => request => https://api.businesscentral.dynamics.com/v2.0/tenant/sandbox/api/v2.0/companies(companyId)/customers",
            "data": {
                "message": "Request failed with status code 400",
                "name": "Error",
                "stack": "Error: Request failed with status code 400\n    at createError (path)\n    at settle (path)\n    at IncomingMessage.handleStreamEnd (path)\n    at IncomingMessage.emit (events.js:327:22)\n    at endReadableNT (internal/streams/readable.js:1327:12)\n    at processTicksAndRejections (internal/process/task_queues.js:80:21)",
                "config": {
                    "url": "https://api.businesscentral.dynamics.com/v2.0/tenant/sandbox/api/v2.0/companies(companyId)/customers",
                    "method": "post",
                    "data": "{\"number\":\"TCUST\",\"displayName\":\"Test Customer\"}",
                    "headers": {
                        "Accept": "application/json, text/plain, */*",
                        "Content-Type": "application/json",
                        "Authorization": "token",
                        "User-Agent": "axios/0.21.4",
                        "Content-Length": 48
                    },
                    "params": {},
                    "transformRequest": [
                        null
                    ],
                    "transformResponse": [
                        null
                    ],
                    "timeout": 0,
                    "xsrfCookieName": "XSRF-TOKEN",
                    "xsrfHeaderName": "X-XSRF-TOKEN",
                    "maxContentLength": -1,
                    "maxBodyLength": -1,
                    "transitional": {
                        "silentJSONParsing": true,
                        "forcedJSONParsing": true,
                        "clarifyTimeoutError": false
                    }
                }
            }
        }
    }
}

After doing some research I thought i may be able to provide the posting group within the request body as suggested in this question:

   

{
    "number": "TCUST",
    "displayName": "Test Customer",
    "Gen. Bus. Posting Group": "DEFAULT"
}

Default is a valid posting group and this did not work either. Any other suggestions?

update, i created the DOMESTIC posting group it defaults to and it works fine but i still need to know how to actually set it to a valid one through the api.

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    You have to check with Page : Gen. Business Posting Group and check what are the codes available, and you have to select one of them and put in the request body with that field, and see if problem solves.

    Thanks.

  • AB-24031503-0 Profile Picture
    12 on at
    If you ever figured it out, let me know

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,853 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 915 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 643 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans