INVALID_SESSION_ID API Origin: Application & API OSI layer 5 · Session Last updated 2 Dec 2026

Salesforce API: INVALID_SESSION_ID: Session expired or invalid

The access token or session ID is no longer accepted by Salesforce.

Exact message you may see Session expired or invalid SalesforceSalesforce 401
Seen on: Salesforce

Meaning

Sessions time out, tokens get revoked, or the request goes to the wrong instance (login vs my-domain).

Common causes

  • Session timed out
  • Token revoked or user logged out
  • Wrong instance URL
  • Connected app policy changed

⚡ Quick fix

  1. Refresh the OAuth token or log in again
  2. Use the instance_url returned with the token
  3. Check the connected app's session policy

Detailed fix by platform

cURL

  1. curl -H "Authorization: Bearer $TOKEN" $INSTANCE_URL/services/data/v60.0/limits

How to diagnose

  1. Token — Expired?
  2. Instance — Right URL?
  3. Policy — Timeout setting?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.