Skip to main content

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

HeaderValue
Content-Typeapplication/x-www-form-urlencoded

Request Parameters

ParameterDescriptionRequired
grant_typeMust be set to passwordYes
client_idYour API client IDYes
client_secretYour API client secretYes
usernameYour partner API usernameYes
passwordYour partner API passwordYes

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.