> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routemcp.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce

> Sync contacts, leads, deals, and more with Salesforce CRM via OAuth 2.0 or JWT Bearer.

<img src="https://icon.horse/icon/salesforce.com" alt="Salesforce" style={{ width: "48px", height: "48px", marginBottom: "16px" }} />

## Overview

| Property    | Value                   |
| ----------- | ----------------------- |
| Slug        | `salesforce`            |
| Auth        | OAuth 2.0 / JWT Bearer  |
| API version | v66.0                   |
| Sandbox     | Yes                     |
| Rate limit  | 100 req/min, 25 req/sec |

## Supported resources

| Resource    | List                                      | Get                                       | Create                                    | Update                                    | Delete                                    |
| ----------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
| Contact     | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> |
| Lead        | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> |
| Deal        | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> |
| Meeting     | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> |
| Company     | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> |
| Note        | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> |
| Task        | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> |
| Activity    | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> |
| Pipeline    | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | —                                         | —                                         | —                                         |
| Owner       | <span style={{color: "#16a34a"}}>✓</span> | <span style={{color: "#16a34a"}}>✓</span> | —                                         | —                                         | —                                         |
| Appointment | —                                         | —                                         | —                                         | —                                         | —                                         |

## Connect setup

Salesforce uses OAuth 2.0 with an External Client App. You can optionally configure JWT Bearer for server-to-server authentication.

<Steps>
  <Step title="Create an External Client App in Salesforce">
    Go to **Salesforce Setup** → search **External Client App Manager** in Quick Find → click **New**. Fill in the app name and contact email. Set **Distribution State** to **Packaged**. Expand the **API (Enable OAuth Settings)** section and enable OAuth.
  </Step>

  <Step title="Add the redirect URL">
    In the **Callback URL** field, add:

    ```
    https://api.routemcp.io/api/v1/auth/callback
    ```
  </Step>

  <Step title="Configure OAuth scopes">
    Add the following scopes to **Selected OAuth Scopes**:

    * `Manage user data via APIs (api)`
    * `Perform requests at any time (refresh_token, offline_access)`

    Keep **Require Proof Key for Code Exchange (PKCE)** checked.
  </Step>

  <Step title="Get your Consumer Key and Secret">
    After saving, click **Consumer Key and Secret** in the OAuth Settings section. Copy both values — you'll need them in the Connect widget.
  </Step>

  <Step title="Connect via the widget">
    When your end user opens the Connect widget, they select **Production** or **Sandbox** environment, enter the **Consumer Key** and **Consumer Secret**, then authorize via Salesforce.
  </Step>
</Steps>

## Usage

```bash theme={null}
# List contacts from Salesforce
curl "https://api.routemcp.io/api/v1/crm/contact?provider=salesforce" \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "X-End-User-Id: user-123"

# Create a deal (opportunity)
curl -X POST "https://api.routemcp.io/api/v1/crm/deal?provider=salesforce" \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -H "X-End-User-Id: user-123" \
  -d '{ "name": "Acme Corp", "amount": 50000, "stage": "Prospecting", "close_date": "2026-06-30" }'
```

## Notes

* Salesforce uses SOQL queries internally — listing operations select specific fields rather than returning all properties.
* The `instance_url` is stored per connection and used for all API calls (each Salesforce org has a unique URL).
* Notes are mapped to the classic Salesforce Note object. A `content` and parent record (`contact`, `account`, or `opportunity`) are required when creating notes.
* Pipeline is read-only — stages come from the OpportunityStage metadata object.
* Use `environment: "sandbox"` in your connect token to connect sandbox orgs via `test.salesforce.com`.
* Salesforce requires `LastName` for contacts and leads, `Name` + `StageName` + `CloseDate` for deals.
