I'm trying to interact with Metadata API from Python, for multiple different Salesforce accounts / organizations.

I'm using OAuth flow so nobody needs to give me their username + password, and can just reuse the OAuth process we went through for use with REST API.

The docs say that the login request (which uses username + password) is how you get the sessionID and Metadata API server url in order to make subsequent requests. The docs (e.g. here) say you can use OAuth instead, and replace sessionID with the access token you get from OAuth.

But what about the other part, the server url? If OAuth replaces that login request, how can I get this Metadata API server url (or make requests without it, or whatever)?

1 Answer 1


The Server URLs for the various APIs are easy enough to move between:

  • Enterprise API:
  • Partner API:
  • Metadata API:
    Note this is easy to get using the LoginResult.metadataServerUrl
  • Apex API:
  • Tooling API:

If coming from an OAuth flow, look for the instance_url that you can use as the basis for the SOAP urls.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .