LinkedIn Session Expired

LinkedIn write tools (send_linkedin_message, send_linkedin_invitation) and some read tools that hit gated content rely on a browser session bound to your org via connect_linkedin. Sessions expire periodically — when they do, write calls 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://socials.gtm-engine.sh/api/v0/list_connected_linkedin_accounts \
    > -H "Authorization: Bearer $GTM_ENGINE_API_KEY"

    If the response shows the account as expired or doesn’t list it, the session is gone.

  2. Reconnect.

    $curl -X POST https://socials.gtm-engine.sh/api/v0/connect_linkedin \
    > -H "Authorization: Bearer $GTM_ENGINE_API_KEY"

    The response includes a one-time login URL. Open it, sign in to LinkedIn, and the session is rebound.

  3. Retry the original call.

    The session is bound to your org, so any subsequent write tool — same workflow, same agent, anywhere — will pick it up automatically.

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.