LinkedIn Session Expired

LinkedIn write tools (send_linkedin_message, send_linkedin_invitation) and some read tools that hit gated content rely on a logged-in session shared through the browser extension. The extension re-syncs your session automatically while that browser is open, but if everyone who connected has their browser closed for a long stretch, the pooled session can go stale — write calls then return an error indicating reauthentication is needed.

Symptoms

  • send_linkedin_invitation / send_linkedin_message returns an error mentioning session_expired, not_authenticated, or login_required.
  • list_linkedin_conversations returns an empty list when you expected results.
  • Read tools that don’t normally need a session (e.g. get_linkedin_company_url) keep working — those use a separate non-session backend.

Recovery

  1. Check session status.

    $curl https://api.gtm-tools.sh/api/v0/list_connected_linkedin_accounts \
    > -H "Authorization: Bearer $GTM_TOOLS_API_KEY"

    If the response doesn’t list the account, no fresh session is available.

  2. Refresh the session.

    Open LinkedIn in a browser where the extension is installed and connected, and make sure you’re logged in. The extension re-syncs the moment your session cookie refreshes, pushing a fresh session to the workspace pool. If no one has connected the extension yet, install it and press Connect.

  3. Retry the original call.

    The session lives in the workspace pool, so any subsequent write tool — same workflow, same agent, anywhere — picks it up automatically. The more teammates who connect, the more resilient the pool.

Avoiding expiration

LinkedIn rotates sessions aggressively for accounts that look like automation. To keep yours stable:

  • Don’t blast. Spread invitations across the day; LinkedIn flags burst patterns.
  • Cap concurrency. Keep parallel write calls below 3.
  • Vary outreach. Don’t send the same exact message body to many recipients in quick succession — LinkedIn’s spam filter triggers on identical templates.

If your session expires more than once a week, slow your write cadence first before assuming a bug.

Read tools that don’t need a session

Most read tools work without a logged-in session — they hit the underlying provider through a separate path:

ToolNeeds session?
get_linkedin_company_urlNo
get_linkedin_profile_urlNo
get_linkedin_profileNo
get_linkedin_companyNo
get_linkedin_postNo
get_linkedin_jobNo
list_linkedin_jobsNo
list_linkedin_company_postsNo
list_user_postsNo
list_linkedin_company_employeesNo
list_linkedin_post_reactionsNo
list_linkedin_post_commentsNo
list_linkedin_saved_postsYes — saved posts are personal
list_linkedin_conversationsYes — DMs are personal
send_linkedin_messageYes
send_linkedin_invitationYes

So in practice, only the write tools and the two personal-data read tools fail when the session is gone.