HTTP status 401. An API key request can get this code.
The API key or the session is missing, wrong, revoked or expired.
Recovery
For missing credentials, send Authorization: Bearer <key>. For an invalid key, use an active key from Settings > API in the Affinity app. The response does not distinguish wrong, revoked or expired keys. In the app, sign in again.
Branch on code, not on the text of detail. Give Affinity the requestId when you report a problem.