Differences in Error Responses

The document here:
https://pipedrive.readme.io/docs/core-api-concepts-responses

says:
Upon success being false, an optional error parameter (string) may be given.
AND
Error response
All error responses follow the same schema:

JSON
{
success: false,
error: “Requested service is not availabile”, //main error message
error_info: “Please check developers.pipedrive.com”,
data: null,
additional_data: null
}

but this is different from the error responses I’m seeing when invoking the actual api
This is the response I see with a bad api_token
{
“success”: false,
“error”: “unauthorized access”,
“errorCode”: 401
}

This is the error response I see with an invalid field key value
https://api.pipedrive.com/v1/persons/search?api_token=… &term=…&fields=emailz

{ "success": false,
    "error": {
        "message": "ServerError [ERR_INVALID_INPUT]: Invalid input: \"fields[0]\" must be one of [custom_fields, notes, name, email, phone]",
        "code": 400,
        "failed_fields": [
            "fields.0"
        ]
    }

}
In this response, the error is an object NOT a string like the developer documentation says and so it fails marshalling in my environment.

By chance is this just an issue in a single endpoint or a type inference issue on the pipedrive backend?

Thanks in Advance,
-jacobd

Hey @Jacob_Danner
Thanks for bringing this issue to our attention! This behavior of the error message having a different structure, including not being a string, is a bug on our side. We’ll prioritize fixing it as soon as possible.
In reality, all the endpoints should follow the error structure specified in our developer docs :slight_smile:

Hello,
Any feedback on this bug?

Hey, @DouglasCarvalhoPereira :wave:

This bug was fixed in July 2021 with an announcement in our Changelog. Since the fix, the error is indeed a string, not an object.