Authentication
Getting Access Token
To access the API, you'll need to obtain an OAuth 2.0 access token.
Endpoint
Staging
POST https://test.salesforce.com/services/oauth2/token
Production
POST https://login.salesforce.com/services/oauth2/token
Headers
| Header | Value |
|---|---|
| Content-Type | application/x-www-form-urlencoded |
Request Parameters
| Parameter | Description | Required |
|---|---|---|
| grant_type | Must be set to password | Yes |
| client_id | Your API client ID | Yes |
| client_secret | Your API client secret | Yes |
| username | Your partner API username | Yes |
| password | Your partner API password | Yes |
Sample Request
Staging
curl -X POST https://test.salesforce.com/services/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=password" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "username=YOUR_USERNAME" \
-d "password=YOUR_PASSWORD"
Production
curl -X POST https://login.salesforce.com/services/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=password" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "username=YOUR_USERNAME" \
-d "password=YOUR_PASSWORD"
Sample Response
{
"access_token": "YOUR_ACCESS_TOKEN",
"instance_url": "https://missioncapital--full.sandbox.my.salesforce.com",
"id": "https://test.salesforce.com/id/00DEa000007nG1EMAU/005Qm000002Vk5RIAS",
"token_type": "Bearer",
"issued_at": "1726235737296",
"signature": "0SpGlyCeRwTzcCFHRUT9OCFVNb4zUJKYFsnjN5Ttiu0="
}
Using the Access Token
For all subsequent API requests, include the access token in the Authorization header:
Authorization: Bearer YOUR_ACCESS_TOKEN
Token Expiration
Access tokens expire after 2 hours. When a token expires, you'll need to request a new one using the same process.