Rest API error(SandBox) - Creating Company

I can successfully create a test company in our NON-SandBox account with the below format, but it fails with error(400 - Bad Request) when using the same code with our SandBox account:

{
     "address": {
         "line1": "Test Line 1",
         "line2": null,
         "locality": "Test",
         "region": "Louisiana",
         "zip_code": "70471",
         "zip_four": null,
         "country_code": "USA"
     },
     "company_name": "Test Company",
     "fax_number": {
         "number": null,
         "type": null
     },
     "notes": "Test Notes",
     "opt_in_reason": "Company opted-in through webform",
     "phone_number": {
         "extension": null,
         "number": "(337)337-3377",
         "type": "Main"
     }
 }

Is there anyway to get more details about what the API doesn’t like?

TIA

What headers are returned? There should also be a response body with some additional information about the failure.

1 Like

Hi @Billy_Rowe, I would check the phone number type that you’re providing. “Main” doesn’t appear to be one of the default values so it’s possible that it doesn’t exist in your sandbox application.

Yep, That was it!!
Thanks to bradb I was finally able to delve into the details of the complete response and see the error({“message”:“Phone Number Type is invalid”}).

I have now copied all the phone and fax types setup in the production account to SandBox account settings.