🔗 How to Call Salesforce Standard APIs via Postman
If you’re a developer or administrator looking to integrate or test Salesforce functionality outside of its UI, the Salesforce REST API provides powerful capabilities — and Postman is a great tool to interact with it.
This guide will walk you through authenticating with Salesforce and performing basic CRUD operations using Postman.
🧰 Prerequisites
- A Salesforce Developer Edition org
- A connected app with OAuth credentials
- Postman installed (download from https://www.postman.com/)
📌 Step 1: Create a Connected App in Salesforce
- Go to Setup → Apps → App Manager.
- Click New Connected App.
- Fill in:
- App Name: Postman Integration
- Email: Your email
- Enable OAuth Settings:
- Check Enable OAuth Settings
- Callback URL: https://login.salesforce.com/services/oauth2/callback
- Selected OAuth Scopes: Add Full access (full) or Access and manage your data (api)
- Save and note down the Consumer Key and Consumer Secret.
🔐 Step 2: Authenticate via OAuth 2.0 (Username-Password Flow)
In Postman:
- Request Type: POST
- URL:
https://login.salesforce.com/services/oauth2/token
- Body (x-www-form-urlencoded):
- grant_type: password
- client_id: <your consumer key>
- client_secret: <your consumer secret>
- username: your_salesforce_username
- password: your_salesforce_password_and_security_token
💡 Note: Append your security token to your password if you’re using login.salesforce.com and haven’t whitelisted your IP.
- Click Send.
You should receive a response like:
Json:
{
“access_token”: “00Dxx0000001gPz!AQ4AQ…”,
“instance_url”: “https://yourInstance.salesforce.com”,
“id”: “…”,
“token_type”: “Bearer”
}
🔄 Step 3: Perform API Calls
Use the returned access_token and instance_url to make requests.
📥 Create a Record (POST)
- Method: POST
- URL:
https://yourInstance.salesforce.com/services/data/v60.0/sobjects/Lead/
- Headers:
- Authorization: Bearer <your access_token>
- Content-Type: application/json
- Body (raw → JSON):
Json:
{
“LastName”: “Test”,
“Company”: “Test Company”
}
📤 Update a Record (PATCH)
- Method: PATCH
- URL:
https://yourInstance.salesforce.com/services/data/v60.0/sobjects/Lead/00Q5g00000XXXXXXAAE
- Body:
{
“Company”: “Updated Company”
}
🗑️ Delete a Record (DELETE)
- Method: DELETE
- URL:
https://yourInstance.salesforce.com/services/data/v60.0/sobjects/Lead/00Q5g00000XXXXXXAAE
📋 Get a Record (GET)
- Method: GET
- URL:
https://yourInstance.salesforce.com/services/data/v60.0/sobjects/Lead/00Q5g00000XXXXXXAAE
🧠 Tips
- Always check the API version you’re using. You can list supported versions with:
GET /services/data/
- To run SOQL queries:
GET /services/data/v60.0/query/?q=SELECT+Id,+Name+FROM+Lead
Create multiple records using Postman:
✅ Option 1: Composite Collections API (Preferred for Bulk Create)
This allows you to create up to 200 records in a single API call.
🔧 Request
- Method: POST
- URL:
https://yourInstance.salesforce.com/services/data/v60.0/composite/sobjects
- Headers:
- Authorization: Bearer YOUR_ACCESS_TOKEN
- Content-Type: application/json
📦 Body Example (Creating Multiple Leads)
Json:
{
“allOrNone”: true,
“records”: [
{
“attributes”: { “type”: “Lead” },
“LastName”: “Smith”,
“Company”: “Acme Inc”
},
{
“attributes”: { “type”: “Lead” },
“LastName”: “Jones”,
“Company”: “Globex Corp”
}
]
}
- allOrNone: true means either all succeed or none are created.
Delete multiple records using Postman:
🔗 Endpoint
Method: DELETE
URL:
bash
https://yourInstance.salesforce.com/services/data/v60.0/composite/batch
🔐 Headers
http
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
📝 Body (Raw → JSON)
Replace the IDs below with the actual Salesforce record IDs you want to delete:
Json:
{
“batchRequests”: [
{
“method”: “DELETE”,
“url”: “/services/data/v60.0/sobjects/Lead/00Q5g00000XXXX1AAE”
},
{
“method”: “DELETE”,
“url”: “/services/data/v60.0/sobjects/Lead/00Q5g00000XXXX2AAE”
},
{
“method”: “DELETE”,
“url”: “/services/data/v60.0/sobjects/Lead/00Q5g00000XXXX3AAE”
},
{
“method”: “DELETE”,
“url”: “/services/data/v60.0/sobjects/Lead/00Q5g00000XXXX4AAE”
}
]
}
Update multiple records using Postman:
🔗 Endpoint
Method: PATCH
URL:
https://yourInstance.salesforce.com/services/data/v60.0/composite/batch
🔐 Headers
http
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
📝 Body (Raw → JSON)
Update this example with your actual object type (e.g., Lead) and record IDs:
Json:
{
“batchRequests”: [
{
“method”: “PATCH”,
“url”: “/services/data/v60.0/sobjects/Lead/00Q5g00000XXXX1AAE”,
“richInput”: {
“Company”: “New Company 1”
}
},
{
“method”: “PATCH”,
“url”: “/services/data/v60.0/sobjects/Lead/00Q5g00000XXXX2AAE”,
“richInput”: {
“Company”: “New Company 2”
}
},
{
“method”: “PATCH”,
“url”: “/services/data/v60.0/sobjects/Lead/00Q5g00000XXXX3AAE”,
“richInput”: {
“Company”: “New Company 3”
}
},
{
“method”: “PATCH”,
“url”: “/services/data/v60.0/sobjects/Lead/00Q5g00000XXXX4AAE”,
“richInput”: {
“Company”: “New Company 4”
}
}
]
}
Get multiple records using Postman:
🔗 Endpoint
Method: GET
URL:
https://yourInstance.salesforce.com/services/data/v60.0/query?q=SELECT+Id,Name+FROM+Lead+LIMIT+4
Replace yourInstance with your Salesforce instance, and customize the SOQL query as needed.
🔐 Headers
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type is optional for GET, but you can include:
Content-Type: application/json