PurpleTRAC does not return one error envelope. Different endpoints return different shapes, some responses are plain text, and a few are empty. Handle the status code first and treat the body as best-effort detail.If you also build against Insights, note that the two products disagree on what 403 means. Here it says the feature is not enabled for your account.
Almost always: the endpoint needs an optional feature that is not enabled for your account. PUT /transaction/{id}/voyage_update is the exception, where it means the transaction belongs to a different account
404
The transaction or resource does not exist
405
That method is not supported on that endpoint
409
A duplicate transaction already exists
500
System failure, a missing critical field, or a report that is not ready yet
403 does not always mean the same thing
On nearly every endpoint a 403 says the feature behind it is an addon your account does not have. On PUT /transaction/{id}/voyage_update it says the transaction belongs to another account. If you handle the two cases differently, branch on the endpoint as well as the code.