Both are different status codes:
SalesForce API failed (Unauthorized):
a:1:{i:0;O:8:"stdClass":2:{s:7:"message";s:26:"Session expired or invalid";s:9:"errorCode";s:18:"INVALID_SESSION_ID";}} - This one is Status Code: 401 which indicates that the API request lacks valid authentication credentials. This usually means the API user hasn't been granted the necessary permissions to access the requested resource. Related Link - https://help.salesforce.com/s/articleView?id=001122773&type=1
SalesForce API failed (Status: 400)
a:2:{s:5:"error";s:13:"invalid_grant";s:17:"error_description";s:22:"authentication failure";} -
This one is Status Code: 400 which usually indicates that the API request did not have the necessary authentication or authorization to access the requested resource. This can happen for a variety of reasons, including invalid credentials, expired sessions, or insufficient permissions. Related link - https://help.salesforce.com/s/articleView?id=001122773&type=1