<!-- Source: https://docs.vinsi.ai/api-integration/salesforce -->
# Salesforce API Integration

Connect Salesforce to VINSI.AI to read and write CRM data through Salesforce’s REST API using OAuth 2.0 credentials.

Created: January 26, 2026

## Overview

Salesforce offers a powerful REST API for accessing CRM objects such as Contacts, Accounts, Leads, and Opportunities using standard HTTP methods (GET, POST, PATCH, DELETE).

By connecting your Salesforce org and defining Custom API tools, AI Phone Agents can safely query CRM data during live calls or automated workflows.

## Authentication

Salesforce uses OAuth 2.0 for secure API access. You must create a Connected App in Salesforce and grant permissions that allow REST API usage.

1. In Salesforce Setup, open **App Manager** and create a new Connected App.
2. Enable **OAuth 2.0**.
3. Add the `api` scope (and optionally` refresh_token` for long-lived access).
4. Copy the Client ID, Client Secret, and configure the Host Domain in the VINSI dashboard.

## Salesforce REST API

Salesforce REST API endpoints are exposed under the following path:

- Query records:`/services/data/vXX.X/query?q=SELECT+Id,Name+FROM+Contact`
- Get a single object:`/services/data/vXX.X/sobjects/Contact/{id}`

Replace `vXX.X` with a supported API version (for example, `v60.0`).

## Custom API Tool Configuration

Add New Tool

Navigate to **Tools → Add Tool** and configure the following fields:

- **Tool Type:** Custom API
- **Tool Name:** Salesforce – Query Contacts
- **Server URL:** `https://<your-host-domain>/services/data/v60.0/query?q=SELECT+Id,Name+FROM+Contact`
- **Method:** GET
- **Headers:** OAuth Authorization (auto-injected)

## Example: Query Contacts

Salesforce Custom API Tool

Server URL:
https://<your-host-domain>/services/data/v60.0/query?q=SELECT+Id,Name+FROM+Contact

Method:
GET

The AI agent can invoke this tool to fetch CRM data in real time during a call.

## Important Notes

- Always scope tools to a single responsibility.
- Use the correct Salesforce instance domain.
- Salesforce enforces API rate limits per org.
