When the "For admin-approved users, limit API access to only allowlisted connected apps" setting is enabled in a Salesforce org, opening the Developer Console can show the error "This session is not valid for use with the REST API." This happens because the Developer Console runs on top of the REST API, which is one of the API types this setting restricts.
This article explains why the Developer Console shows a REST API session error when API allowlisting is enabled, and what options admins have to work around it.
For the "For admin-approved users, limit API access to only allowlisted connected apps" setting, this behavior is considered working as designed. The Developer Console is built on top of the REST API, and the REST API is one of the API types blocked by this setting.
One workaround is to enable the profile permission "Use Any API Client" and assign that profile to the appropriate users.
Note: Enabling this permission also allows usage of all connected apps, not just the Developer Console, so weigh this against your org's security requirements.
The Developer Console is in maintenance-only status, and Salesforce is only making changes for serious security issues — this behavior isn't expected to change. Salesforce recommends switching to modern developer tools such as Salesforce CLI, VS Code, and Salesforce Code Builder whenever possible.
004637119

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.