Response from the API endpoint is returning 500 but support says API server is not down

I am getting a 500 when requesting the following right now :
curl --head

HTTP/1.1 500 
Date: Fri, 04 Feb 2022 18:27:27 GMT
Content-Type: application/json;charset=UTF-8
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache, no-store
Expires: Fri, 04 Feb 2022 18:27:27 GMT
Set-Cookie: JSESSIONID=xxxxx; Path=/; Secure; HttpOnly
Strict-Transport-Security: max-age=31536000;includeSubDomains
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-store
vary: accept-encoding
Content-Language: en-US
Via: 1.1 google
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri=""
Set-Cookie: GCLB=CMrImuTym-6xNQ; path=/; HttpOnly; expires=Sat, 05-Feb-2022 06:27:27 GMT
Set-Cookie: __cf_bm=xxxxxx-xxxx-0-xxx/D/S5x/xxxxx/xxxxx=; path=/; expires=Fri, 04-Feb-22 18:57:27 GMT;; HttpOnly; Secure; SameSite=None
Server: cloudflare
CF-RAY: xxxx-SEA

But chat support says that the API server is not down. I cross-checked with the curl command on the server too. Same response - 500.

Good afternoon Dave,

A 500 usually indicates there is some kind of problem processing the record for display; please file a support ticket here to have our Advanced Support team look at the specific data for the record in question.

Additionally, you shouldn’t pass access_token as a query parameter, and it is not a supported operation so we don’t guarantee that it will function in that manner in the future. The proper method is to pass it as an “Authorization” header as “Bearer {token}”.

The API is returning 200 now with the correct customer data - no change was done at my end.

You mean to say as in the header of the request ? So I have to switch to using cURL instead of file_get_contents ?

$url = "{$transaction_id}?access_token={$token}";
$data_transactions = file_get_contents($url);

To this ?

$url = "{$transaction_id}";
$authorization = "Authorization: Bearer {$token}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));                
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);                
$response = curl_exec($ch);
$json_transactions = json_decode($response);

I’m not a PHP guy, but it looks like you can set the Headers in an object, open the stream and pass it to that method:

// Create a stream
$opts = [
    "http" => [
        "method" => "GET",
        "header" => "Authorization: Bearer {bearerToken}\r\n" .
            "SomeOtherHeader: foobar\r\n"

// DOCS:
$context = stream_context_create($opts);

// Open the file using the HTTP headers set above
// DOCS:
$file = file_get_contents('', false, $context);