INVALID_SESSION_ID: meaning and how to fix it

Access and login Checked against the official docs on Source: SOAP API Developer Guide: Core Data Types, StatusCode

Quick answer

INVALID_SESSION_ID: The session ID or access token sent with the request is expired, malformed or no longer valid, or it was sent to the wrong instance URL. Start with: Log in or refresh the OAuth access token and retry.

Typical message: INVALID_SESSION_ID: Session expired or invalid

Cause

The session ID or access token sent with the request is expired, malformed or no longer valid, or it was sent to the wrong instance URL.

How to fix INVALID_SESSION_ID

  1. Log in or refresh the OAuth access token and retry.
  2. Use the instance_url returned at login as the base URL for API calls.
  3. Check that the Authorization header is "Bearer <token>" with no extra characters.

Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.

Frequently asked questions

What does INVALID_SESSION_ID mean in Salesforce?

The session ID or access token sent with the request is expired, malformed or no longer valid, or it was sent to the wrong instance URL.

How do I fix INVALID_SESSION_ID?

1. Log in or refresh the OAuth access token and retry. 2. Use the instance_url returned at login as the base URL for API calls. 3. Check that the Authorization header is "Bearer <token>" with no extra characters.

More Access and login errors

SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.