function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ignacio Sales 1Ignacio Sales 1 

Error calling the metadata API: com.sforce.ws.SoapFaultException: INVALID_SESSION_ID: This session is not valid for use with the API

We are using the Metadata API and calling the method:

 MetadataConnection.describeMetadata(version) 

Throws the exception com.sforce.ws.SoapFaultException: INVALID_SESSION_ID: This session is not valid for use with the API

The user who has logged in successfully has the System Administrator profile, which includes the "ModifyAllData" and "API Enabled" permissions activated. We found some posts which specifically identify a missing "API Enabled" permission as a cause for this error, but this is not our case.  

Any other ideas as to what could cause this? 

Any help much appreciated.

Ignacio