Get Started
Configure your Org
Which API Should I Use?
Connect to REST-based APIs
Connect to SOAP API
Connect to Direct Email Send API
Security
To use SOAP API, pass your username, password, and security token to the login() operation. When you do, the API returns information about your API user. It also provides a session ID, which you include in the header of each subsequent SOAP request that you issue. A session ID remains valid for 2 hours. After the session ID expires, call the login() operation again to obtain a new one.
The Salesforce Platform requires you to provide a security token to authorize requests that you make to SOAP API. A security token is a string of text that is unique to your user. Later, when you call the login() operation, you append the security token to your password. If you don’t have a security token or you lost it, you can obtain one using the Salesforce web app.
A Web Services Description Language (WSDL) file describes the functionality of a web service such as an API. Salesforce provides two WSDLs: an Enterprise WSDL that reflects the exact configuration of your Salesforce org and a Partner WSDL that applies to all Salesforce orgs. You can download both WSDL files using the Salesforce web app.
API.In some web browsers, the contents of the WSDL are displayed in a new browser window. In this situation, right-click anywhere on the page, click Save page as, and then save the WSDL file.
Note
The instructions for loading a WSDL into your web services client depend on which client you use. Consult the documentation for your client. These instructions describe using SoapUI.
SoapUI parses the WSDL file and generates a list of all available API operations.
After you obtain your security token and set up your SOAP client, you can issue a request to the login() operation to obtain your session ID.
In your SOAP client, create a request that uses the login() operation.
In the body of the SOAP request, delete the contents of the SOAP header, which is everything between <soapenv:Header> and </soapenv:Header>.
Change the value of urn:username to the username of your API user.
Change the value of urn:password to the password of your API user, and then paste your security token to the end of the password.
Submit the SOAP request. If you entered the correct username and password, the response from the API resembles this example.
1<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2 <soapenv:Body>
3 <loginResponse>
4 <result>
5 <metadataServerUrl>https://login.salesforce.com/services/Soap/c/60.0/wRYO4cyiogGJuSu</metadataSezverUz1>
6 <passwordExpired>false</passwordExpired>
7 <sandbox>false</sandbox>
8 <serverUrl>https://login.salesforce.com/services/Soap/c/60.0/wRYO4cyiogGJuSu</serverUrl>
9 <sessionId>wRYO4cyiogGJuSu!AQEAOK23h7Ak_SyGTu_DfrbaObz12XP7MxGCmTTT2zKkKRAB_f4t8XkJ.5gSSO1C_xyRPnrq.Ak.qt81Pg4PMkuAhtw7frLz</sessionId>
10 <userId>HQ7tfVfduzymohBchM</userId>
11 <userInfo>
12 <accessibilityMode>false</accessibilityMode>
13 <currencySymbol>$</currencySymbol>
14 <orgAttachmentFileSizeLimit>5242880</orgAttachmentFileSizeLimit>
15 <orgDefaultCurrencyIsoCode>USD</orgDefaultCurrencyIsoCode>
16 <orgDisallowHtmlAttachments> false</orgDisallowHtmlAttachments>
17 <orgHasPersonAccounts>false</orgHasPersonAccounts>
18 <organizationId>Bg2kLrUat1Tl1seqDj</organizationId>
19 <organizationMultiCurrency>false</organizationMultiCurrency>
20 <organizationName>DreamHouse Realty</organizationName>
21 <profileId>3nOZ5jz8ULZgsn2z3</profileId>
22 <roleId xsi:nil="true"/>
23 <sessionSecondsValid>7200</sessionSecondsValid>
24 <userDefaultCurrencyIsoCode xsi:nil="true"/>
25 <userEmail>dangelo.cunningham@example.com</userEmail>
26 <userFullName>D'Angelo Cunningham</userFullName>
27 <userId>HQ7tfVfduzymohBchM</userId>
28 <userLanguage>en_US</userLanguage>
29 <userLocale>en_US</userLocale>
30 <userName>dangelo.cunningham@example.com</userName>
31 <userTimeZone>America/Los_Angeles</userTimeZone>
32 <userType>Standard</userType>
33 <userUiSkin>Theme3</userUiSkin>
34 </userInfo>
35 </result>
36 </loginResponse>
37 </soapenv:Body>
38</soapenv:Envelope>The URLs and IDs in this example are randomly generated and can’t be used to issue or authenticate URL requests.
Note
<sessionId>...</sessionId> tags.In subsequent requests that you issue to the API, add the session ID to the SOAP header.