Where did you get your accessToken from? If you used OAuth to establish the session then you will need to have the `web` OAuth scope to use the sessionid for what is essentially a screen scraping web request. Having the `api` scope would be sufficient for the Partner API, but for for mocking UI requests. ![enter image description here][1] Other than that, as you have found, you need to put the sessionId/accessToken into a `sid` cookie along with the request. ---- You can check your OAuth Scopes under > Setup > App Setup > Create > Apps > [App Name]. It should appear next to Selected OAuth Scopes. When calling `/services/oauth2/authorize` I'm using `response_type=Token`. I'm also passing a scope query string parameter that includes `web`. So I've specified the web scope on both the App and when initiating the OAuth process. It appears you are using the [Web Server OAuth Authentication Flow][2]. The scope parameter is applicable here as well. > **scope** Specifies what data your application can access. See “[Scope Parameter Values][3]” in the online help for more information. [1]: https://i.sstatic.net/jzzuP.png [2]: http://www.salesforce.com/us/developer/docs/api_rest/Content/intro_understanding_web_server_oauth_flow.htm [3]: https://help.salesforce.com/HTViewHelpDoc?id=remoteaccess_oauth_scopes.htm&language=en_US