Everything an AI agent can do with the Salesforce API.

A reference guide for building AI agents: every method, how to authenticate, and the permissions each one needs.

Endpoints24
API versionv67.0
Last updated23 June 2026
Orientation

How the Salesforce API works.

The Salesforce API is how an app or AI agent works with a Salesforce org: reading and writing records like accounts and contacts, running a SOQL query, searching across objects, or batching several changes into one call. Access is granted through an OAuth token whose scopes, like api or full, set the kinds of calls allowed, while the object and field permissions of the user behind the token bound which records it can actually touch. Salesforce ships three dated releases a year and can push a change event onto an event bus whenever a record is created, updated, or deleted.

24Endpoints
5Capability groups
13Read
11Write
5Permissions
Authentication
Salesforce authenticates calls with an OAuth 2.0 access token sent as a Bearer token. An app obtains one through an external client app or connected app and one of several OAuth flows, such as the web server, JWT bearer, or client credentials flow. The token's OAuth scopes set the broad surface it can reach, like api for general API access or full for everything the user can see. Connected apps can no longer be created as of Spring '26, so external client apps are the path for new integrations.
Permissions
Two layers decide what a call can do. OAuth scopes on the token gate the categories of access, like api, refresh_token, full, or chatter_api. Underneath, the user the token represents has object permissions (read, create, edit, delete per object), field-level security, and sharing rules, set through profiles and permission sets. A call can never reach past what that user is allowed to see, whatever scope the token holds.
Versioning
Every request names a dated version in its path, like v67.0, which matches one of the three yearly releases. New versions add features without breaking older ones, and Salesforce supports each version for at least three years before retirement, after which a call to it returns 410 GONE. Versions 21.0 through 30.0 were retired as of Summer '25.
Data model
Records belong to standard or custom objects, called sObjects, addressed at predictable /sobjects// paths. Salesforce returns JSON by default and supports XML. SOQL queries pull structured record sets and page through a nextRecordsUrl cursor; SOSL searches text across many objects at once. Composite resources bundle related calls so several reads and writes run in a single request.
Connect & authenticate

Connection & authentication methods.

How an app or AI agent connects to Salesforce determines what it can reach. There is a route for reading and writing records and running queries, a route for receiving record changes as they happen, and a local server that exposes Salesforce developer tools to agents, and each is governed by the OAuth scopes on the token and the object and field permissions of the user behind it.

Ways to connect

REST API

The REST API reads and writes records, runs SOQL queries and SOSL searches, and describes object metadata, at /services/data/v67.0/ on the org's My Domain host. It returns JSON by default (XML is supported), authenticates with an OAuth 2.0 Bearer token, and names the dated version in the path so an integration can pin a version. Composite resources bundle several calls into one request.

Best forConnecting an app or AI agent to Salesforce records and queries.
Governed byThe OAuth scopes on the token and the user's object and field permissions.
Docs ↗

Pub/Sub API (change events)

The Pub/Sub API is a gRPC interface for subscribing to and publishing platform events and Change Data Capture change events, delivering Avro-encoded messages over HTTP/2 with bidirectional streaming. A subscriber learns about record changes in near real time without polling. The older CometD-based Streaming API delivers the same change events as JSON. Events are retained on the event bus for 72 hours for replay.

Best forReceiving record changes and platform events at an app or AI agent.
Governed byThe OAuth token and the subscriber's permission on the channel.
Docs ↗

DX MCP Server

The Salesforce DX MCP Server is a first-party, open-source Model Context Protocol server, in Beta, that exposes Salesforce developer tools to AI agents and agentic IDEs. It runs locally and works against orgs authenticated through Salesforce CLI, with tools for tasks like querying org metadata, running tests, and deploying code. It is aimed at pro-code developer workflows rather than general record access.

Best forConnecting an AI coding agent to Salesforce developer workflows through MCP.
Governed byThe Salesforce CLI org authentication behind the local server.
Docs ↗
Authentication

OAuth 2.0 Web Server Flow

The standard authorization-code flow: a user logs in and consents, the app receives an authorization code, and exchanges it for an access token and a refresh token. The token represents that user and is bounded by their object and field permissions and the OAuth scopes granted to the app. Best when a real person authorizes the integration.

TokenOAuth access token + refresh token (Bearer)
Best forApps acting on behalf of a logged-in user.
Docs ↗

OAuth 2.0 JWT Bearer Flow

A server-to-server flow with no user interaction. The app signs a JWT with a certificate registered on the external client app or connected app and exchanges it for an access token for a pre-authorized user. There is no refresh token; the app mints a new JWT when the token expires. Best for backend integrations and scheduled jobs.

TokenOAuth access token (Bearer), obtained via signed JWT
Best forServer-to-server integrations without a user present.
Docs ↗

OAuth 2.0 Client Credentials Flow

A server-to-server flow where the app authenticates with its own client ID and secret and acts as a single configured integration user, with no end user involved. The resulting token is bounded by that integration user's permissions. Best for trusted backend services that always run as one identity.

TokenOAuth access token (Bearer)
Best forBackend services running as a fixed integration user.
Docs ↗
Endpoint reference

Every Salesforce REST API method.

Filter by method, access, or permission, or search any path. Select a row for version detail, rate limits, the related webhook event, and the source.

MethodEndpointWhat it doesAccessPermissionVersion

Records (sObject Rows)

Methods for reading, creating, updating, and deleting records of an object.7

Needs the api OAuth scope and Read on the object plus field-level security on the requested fields.

Acts onsObject record
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and Create on the object. Returns 201 with the new record ID.

Acts onsObject record
Permission (capability)Create on object
VersionAvailable since the API’s base version
Webhook eventcdc-create
Rate limitStandard limits apply

Needs the api scope and Edit on the object. Returns 204 No Content on success.

Acts onsObject record
Permission (capability)Edit on object
VersionAvailable since the API’s base version
Webhook eventcdc-update
Rate limitStandard limits apply

Needs the api scope and Delete on the object. Returns 204 No Content.

Acts onsObject record
Permission (capability)Delete on object
VersionAvailable since the API’s base version
Webhook eventcdc-delete
Rate limitStandard limits apply

Needs the api scope plus Create and Edit on the object. A non-unique external ID returns 300 with the matching records.

Acts onsObject record
Permission (capability)Edit on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and Read on the object. Used for incremental sync via start and end parameters.

Acts onsObject change list
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and Read on the object.

Acts onsObject change list
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Object metadata (Describe)

Methods for listing objects and describing an object's fields and relationships.3

Needs the api scope. Returns object-level metadata, not record data.

Acts onsObject metadata
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope. Supports If-Modified-Since to skip unchanged metadata.

Acts onsObject describe
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope. Also returns the org encoding and maximum query batch size.

Acts onobject list
Permission (capability)api
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply
Methods for running SOQL queries and SOSL text searches.4

Needs the api scope and Read on every object and field referenced. Filters out deleted records.

Acts onquery result
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and Read on the referenced objects. Unlike Query, includes records removed by delete or merge.

Acts onquery result
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and Read on the searched objects. The search string must be URL-encoded.

Acts onsearch result
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and Read on the searched objects.

Acts onsearch result
Permission (capability)Read on object
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Composite (batch)

Methods for bundling several reads and writes into one request.7

Needs the api scope. Each subrequest is still bounded by the user's object and field permissions.

Acts oncomposite request
Permission (capability)api
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope. Subrequests don't share state and each is permission-checked.

Acts onbatch request
Permission (capability)api
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and Create on each object. allOrNone controls whether a partial failure rolls everything back.

Acts onsObject collection
Permission (capability)Create on object
VersionAvailable since the API’s base version
Webhook eventcdc-create
Rate limitStandard limits apply

Needs the api scope and Edit on each object. Each record must include its Id.

Acts onsObject collection
Permission (capability)Edit on object
VersionAvailable since the API’s base version
Webhook eventcdc-update
Rate limitStandard limits apply

Needs the api scope and Delete on each object.

Acts onsObject collection
Permission (capability)Delete on object
VersionAvailable since the API’s base version
Webhook eventcdc-delete
Rate limitStandard limits apply

Needs the api scope. Handles larger sets of related records than Composite, with up to 500 nodes per graph.

Acts oncomposite graph
Permission (capability)api
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and Create on each object in the tree. Up to 200 records total per request.

Acts onsObject tree
Permission (capability)Create on object
VersionAvailable since the API’s base version
Webhook eventcdc-create
Rate limitStandard limits apply

Service & limits

Methods for listing API versions, resources, and the org's current limit usage.3

No scope required; this resource is available without authentication.

Acts onversion list
Permission (capability)None required
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope.

Acts onresource list
Permission (capability)api
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the api scope and the View Setup and Configuration permission.

Acts onlimits
Permission (capability)api
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply
No endpoints match those filters.
Webhooks

Webhook events.

Salesforce can notify an app when a record changes through Change Data Capture, which publishes a create, update, delete, or undelete event for an object onto an event bus. A subscriber receives those events over the Pub/Sub API or the older streaming interface, so an integration learns about activity without polling.

EventWhat it signalsTriggered by
Change Data Capture: CREATEA record of a Change Data Capture enabled object was created. The change event carries the new record's fields and a header naming the change type, published onto the event bus./services/data/v67.0/sobjects/{SObject}
/services/data/v67.0/sobjects/{SObject}/{externalIdField}/{value}
/services/data/v67.0/composite/sobjects
Change Data Capture: UPDATEA record was updated. The change event carries the changed fields and the record ID, so a subscriber can sync the change to an external system./services/data/v67.0/sobjects/{SObject}/{id}
/services/data/v67.0/sobjects/{SObject}/{externalIdField}/{value}
/services/data/v67.0/composite/sobjects
Change Data Capture: DELETEA record was deleted. The change event carries the record ID and change type, so a subscriber can remove or flag the corresponding record downstream./services/data/v67.0/sobjects/{SObject}/{id}
/services/data/v67.0/composite/sobjects
No events match that search.
Rate limits & pagination

Rate limits, pagination & request size.

Salesforce meters total API calls across an org over a rolling 24-hour window, with the allocation set by edition and license count, and separately caps how many long-running requests run at once.

Request rate

Salesforce meters total API calls, not a per-method cost. An org gets an allocation of API requests over a rolling 24-hour window, shared across REST, SOAP, Bulk, and Connect, that scales with edition and license count (a paid edition like Enterprise starts at 100,000 per 24 hours, a Developer Edition org at 15,000). It is a soft limit Salesforce lets an org exceed for a while, but sustained overuse is blocked with HTTP 403 and the REQUEST_LIMIT_EXCEEDED error code. A separate concurrency limit caps how many long-running requests (those over 20 seconds) run at once, at 25 in production and 5 in a Developer or sandbox org.

Pagination

A SOQL query returns records in batches. When more remain, the response includes a nextRecordsUrl field and a done flag set to false; an integration requests that URL to fetch the next batch and repeats until done is true. The default query batch size is 2,000 records and can be lowered with the Sforce-Query-Options header. Composite Batch runs up to 25 subrequests in one call, and sObject Collections acts on up to 200 records per request.

Request size

A single request URI plus headers is capped at 16,384 bytes, returning 414 or 431 if exceeded. sObject Collections handles up to 200 records per call, and Composite Batch up to 25 subrequests. Change Data Capture and high-volume platform events are retained on the event bus for 72 hours so a disconnected subscriber can catch up.

Errors

Status codes & error handling.

The status codes an agent should handle, and what to do about each.

StatusCodeMeaningWhat to do
300MULTIPLE_CHOICESAn external ID used in an upsert matched more than one record. The response body lists the matching records.Make the external ID field unique, or use a value that matches a single record, then retry.
400MALFORMED_QUERY / INVALID_FIELDThe request couldn't be understood, usually because the JSON or XML body, a SOQL query, or a field name is invalid.Read the errorCode and message, fix the body, query, or field, and resend. The request isn't retryable as-is.
401INVALID_SESSION_IDThe OAuth token or session has expired or is invalid.Refresh the access token (or re-run the OAuth flow) and resend the request with the new Bearer token.
403REQUEST_LIMIT_EXCEEDED / INSUFFICIENT_ACCESSThe request was refused, either because the org's 24-hour API allocation was exceeded, or because the user lacks permission for the object or record.For a limit error, slow down and spread calls, or raise the allocation. For an access error, grant the needed object or field permission to the user.
404NOT_FOUNDThe requested resource or record couldn't be found, or isn't visible to this user because of sharing.Check the URI and record ID, and confirm the user has sharing access to the record.
405METHOD_NOT_ALLOWEDThe HTTP method isn't allowed for this resource, like a POST to a read-only resource.Use the method the resource supports (GET to read, PATCH to update, DELETE to delete).
410GONEThe API version requested has been retired and removed.Move the integration to a supported, current API version and update any references to the old version.
412PRECONDITION_FAILEDA conditional request header, like If-Match or If-Unmodified-Since, wasn't satisfied because the record changed.Re-fetch the record, get its current ETag or modified date, and retry the conditional request.
500INTERNAL_SERVER_ERRORAn error occurred within the Lightning Platform and the request couldn't be completed.Retry with backoff, and contact Salesforce Customer Support if it persists.
Versioning & freshness

Version history.

Salesforce versions its API with a dated number tied to each of its three yearly releases, Spring, Summer, and Winter, and an older version keeps working for at least three years before retirement.

Version history

What changed, and when

Latest versionv67.0
v67.0Current version
Summer '26

The current API version, matching the Summer '26 release. Salesforce ships three dated releases a year (Spring, Summer, Winter), and every REST request names its version in the path, like /services/data/v67.0/.

What changed
  • Summer '26 introduces a secure-by-default paradigm affecting Apex and database behavior.
  • Creating connected apps remains restricted (as of Spring '26); external client apps are the recommended path for new integrations.
v66.0
Spring '26

The Spring '26 release. From this release, new connected apps can no longer be created; existing connected apps keep working and external client apps replace them for new integrations.

What changed
  • New connected apps can no longer be created; use external client apps instead.
  • Backward-compatible with earlier supported versions.
v65.0
Winter '26

The Winter '26 release. A backward-compatible version that adds features without breaking older versions.

What changed
  • Feature additions across the platform APIs.
  • No breaking changes for existing integrations.
v64.0
Summer '25

The Summer '25 release. With this release, API versions 21.0 through 30.0 were retired and now return 410 GONE.

Migrate: Integrations on API versions 21.0 to 30.0 must move to a supported version.
What changed
  • API versions 21.0 through 30.0 retired and made unavailable.
  • Backward-compatible feature additions.
v62.0
Winter '25

The Winter '25 release, an earlier supported version still accepted by current orgs.

What changed
  • Backward-compatible feature additions.
  • No breaking changes for existing integrations.

Pin a version in the request path and move up on a schedule that suits the integration.

Salesforce REST API release notes ↗
Questions

Salesforce API, answered.

How do OAuth scopes relate to object and field permissions?+
They are two separate layers. OAuth scopes on the token, like api or full, decide which categories of the API a call may use. The user the token represents has object permissions, field-level security, and sharing rules set by profiles and permission sets, which decide which records and fields the call can actually read or change. A token with the full scope still can't see a record its user has no access to.
What's the difference between SOQL and SOSL?+
SOQL (the Query and QueryAll resources) retrieves records from one object or related objects with a structured WHERE clause, and is for precise, filtered reads. SOSL (the Search resource) runs a text search across many objects at once and is for finding records that match a term. Query filters; search finds.
How does Salesforce API versioning work?+
Every request includes a dated version in its path, such as /services/data/v67.0/. A version maps to a Salesforce release (v67.0 is Summer '26), and there are three releases a year. Older versions keep working: Salesforce supports each for at least three years before retiring it, after which a request to that version returns the 410 GONE error. An integration pins a version and upgrades deliberately.
How does an agent get notified when a record changes?+
Through Change Data Capture. When a record is created, updated, deleted, or undeleted, Salesforce publishes a change event for that object onto an event bus. A subscriber receives it over the Pub/Sub API (a gRPC interface delivering Avro-encoded events) or the older CometD streaming interface (JSON events). Events are stored for 72 hours, so a client that disconnects can replay missed changes rather than poll.
How do I update or delete a record with REST API?+
Use the sObject Rows resource at /sobjects//. The HTTP method sets the action: GET retrieves the record, PATCH updates the fields in the request body, and DELETE removes it. A successful update or delete returns 204 No Content. To create or update by a business key instead of the Salesforce ID, use the sObject Rows by External ID resource for an upsert.
What does Composite do, and why use it?+
Composite resources bundle several REST calls into one HTTP request, which saves round trips and counts against limits more efficiently. Composite runs up to 25 subrequests in order and can pass the output of one into the next. Composite Batch runs up to 25 independent subrequests. sObject Collections acts on up to 200 records of the same operation, and Composite Graph handles related records with dependency ordering.
Related

More crm API guides for agents

What is Bollard AI?

Control what every AI agent can do in Salesforce.

Bollard AI sits between a team's AI agents and Salesforce. Grant each agent exactly the access it needs, read or write, object by object, and every call is checked and logged.

  • Set read, write, or full access per agent, never a shared Salesforce login.
  • Denied by default, so an agent reaches only the objects that have been explicitly allowed.
  • Every call recorded in plain English: who, what, where, and the decision.
Salesforce
Sales Ops Agent
Read opportunities ResourceOffReadFull use
Delete records ActionOffReadFull use
Leads ResourceOffReadFull use
Per-agent access, set in Bollard AI, not in Salesforce