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

# Salesforce

> Give your agents the Salesforce REST API — run SOQL queries, create and update any object, describe schema, and run bulk composite operations — through agntdata.

## Overview

The Salesforce connection lets deployed agents work with any Salesforce org: run **SOQL queries** and **SOSL searches** across your data; **create, read, update, upsert, and delete** records for any standard object (`Account`, `Contact`, `Opportunity`, `Lead`, `Case`) or custom object (`*__c`) through a single generic interface; **describe** object metadata (fields, picklists, relationships); run **composite** (bulk) operations of up to 200 records; and read **org limits**.

* **Base URL**: `https://api.agntdata.dev/v1/connections/salesforce`
* **Salesforce auth**: OAuth 2.0 — connect your Salesforce org once from the dashboard. agntdata resolves your org's instance URL from the connection and attaches a fresh access token to every call, so you never pass an `Authorization` header, an instance host, or an API version yourself. Access tokens are refreshed in the background.
* **MCP tools**: agents call `connection_salesforce_*` tools, e.g. `connection_salesforce_query`, `connection_salesforce_create_record`, `connection_salesforce_describe_sobject`.

<Note>
  Salesforce is a **generic** integration — there are no per-object tools. Pass any object's API name as the `sobject` path segment (`/sobjects/Account`, `/sobjects/Invoice__c`). Call **`describe_sobject`** first to learn an object's field API names before building a query or a create/update body. **Reads** go through `query` (SOQL), `search` (SOSL), or `get_record` by id; queries page automatically — pass the trailing locator from `nextRecordsUrl` to `query_more`. **`update_record`** is a PATCH that returns 204 No Content. **`delete_record`** and **`composite_delete`** are **destructive** (records move to the Recycle Bin) — leave them off an agent you don't want deleting data.
</Note>

## Setup

<Steps>
  <Step title="Connect Salesforce">
    In the agntdata dashboard open **Integrations**, pick **Salesforce**, and click **Connect**. You'll be redirected to Salesforce to authorize the org you want to connect and grant API access.
  </Step>

  <Step title="Pick Salesforce tools">
    In an agent's Tools panel, add the Salesforce tools the agent needs — for example `query`, `get_record`, `create_record`, `update_record`, and `describe_sobject`. Destructive delete tools ship too; leave them off an agent you don't want deleting records.
  </Step>
</Steps>

## Examples

### Query accounts (SOQL)

```bash theme={null}
curl -G "https://api.agntdata.dev/v1/connections/salesforce/query" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  --data-urlencode "q=SELECT Id, Name, Industry FROM Account WHERE CreatedDate = THIS_MONTH LIMIT 50"
```

### Read a record by id

```bash theme={null}
curl "https://api.agntdata.dev/v1/connections/salesforce/sobjects/Account/001XXXXXXXXXXXXXXX?fields=Name,Industry" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY"
```

### Describe an object's fields

```bash theme={null}
curl "https://api.agntdata.dev/v1/connections/salesforce/sobjects/Contact/describe" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY"
```

### Create a record

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/salesforce/sobjects/Account" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"Name":"Acme Corp","Industry":"Technology"}'
```

### Update a record (returns 204)

```bash theme={null}
curl -X PATCH "https://api.agntdata.dev/v1/connections/salesforce/sobjects/Account/001XXXXXXXXXXXXXXX" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"Industry":"Finance"}'
```

### Bulk-create records (composite, up to 200)

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/salesforce/composite/sobjects" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"allOrNone":false,"records":[{"attributes":{"type":"Account"},"Name":"Acme Corp"},{"attributes":{"type":"Account"},"Name":"Globex"}]}'
```

### Delete a record

```bash theme={null}
curl -X DELETE "https://api.agntdata.dev/v1/connections/salesforce/sobjects/Account/001XXXXXXXXXXXXXXX" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY"
```
