What we do
Tools
Industries
Department
How we workLet's talk →
Home/Salesforce/Salesforce REST API
Salesforce developer reference

The Salesforce REST API: Connecting, Authenticating and Staying Under the Limit

The Salesforce REST API lets an outside system read, create, update and delete records in your org over HTTPS with JSON, including every custom object and field. The calls themselves are the easy part. Getting authorized has changed, the org has a daily call allowance, and large jobs belong on different endpoints. Here's each of those.

The essentials

Base URL: https://{yourDomain}.my.salesforce.com/services/data/v{version}/. GET /services/data/ lists every version your org supports.

Auth: an OAuth 2.0 access token sent as Authorization: Bearer {token}. New integrations get it from an external client app: creating new connected apps is turned off by default since Spring '26, though existing ones keep working.

Setup External Client App Manager New External Client App

First call: GET .../query?q=SELECT+Id,Name+FROM+Account+LIMIT+10 runs SOQL and returns JSON, with nextRecordsUrl when there's more.

Which OAuth flow for which integration

Integration Flow Watch for
A server job with no person signing in Client credentials: the app swaps its consumer key and secret for a token and runs as the integration user you assign. Anyone holding the key and secret can get a token. Keep them in a secrets store and give the run-as user only the permissions the job needs.
A server job where you can hold a certificate JWT bearer: the app signs a JWT with its private key and Salesforce checks it against the uploaded certificate. The user must be pre-authorized for the app, or every request fails with an authorization error that looks like a bad key.
Your app, with users signing in to their own Salesforce Web server (authorization code) flow, with PKCE. Store refresh tokens securely and handle a revoked token by asking the user to sign in again.
An old script using username, password and security token Move it to one of the flows above. Newer orgs block this flow by default, and external client apps don't support it at all. It's the integration most likely to break unannounced.

How the daily API allowance adds up

Enterprise Edition starts at 100,000 requests per rolling 24 hours and adds 1,000 for each Salesforce license. Other license types add smaller amounts, and other editions differ.

Example · Enterprise Edition org with 40 Salesforce licenses
Base allocation 100,000
40 Salesforce licenses × 1,000 + 40,000
A sync polling 6 objects every minute (6 × 60 × 24) − 8,640
Per-record updates from a form tool, 3,000 a day − 3,000
Left for everything else that day 128,360

Usage shows under Setup › Company Information (API Requests, Last 24 Hours), in the Sforce-Limit-Info header on every REST response, and in GET /limits under DailyApiRequests. Watching that header in code is how you slow down before calls start failing with REQUEST_LIMIT_EXCEEDED.

One call, composite or Bulk API 2.0?

Job Use Why
Read or change one record /sobjects/{Object}/{Id} Fine for a handful. A loop of these is what drains the allowance.
Create or update up to 200 records of the same kind sObject Collections, /composite/sobjects One call for the batch. Set allOrNone to decide whether one bad record rolls back the rest.
Steps that depend on each other /composite, up to 25 subrequests Create an Account, then a Contact on it, by passing @{refId.id} between steps. The whole request counts as one call toward the daily allowance.
Larger related record sets Composite graph Up to 500 nodes per payload, each graph succeeding or failing as a unit.
Thousands of records or more Bulk API 2.0 ingest job Asynchronous CSV upload. Salesforce splits and processes it, and you collect results afterwards.
Large extracts Bulk API 2.0 query job Runs the SOQL server-side and hands back CSV in chunks, instead of paging through thousands of REST calls.

A Bulk API 2.0 upsert, start to finish

  1. 1

    Create the job

    POST /services/data/v{version}/jobs/ingest with the object, operation: upsert and the externalIdFieldName to match on. Upserting on an external ID is what makes a rerun safe.

  2. 2

    Upload the CSV

    PUT the CSV to the job's contentUrl (.../jobs/ingest/{jobId}/batches). Column headers are field API names, not labels.

  3. 3

    Close it

    PATCH .../jobs/ingest/{jobId} with state: UploadComplete. Nothing processes until you do.

  4. 4

    Poll, then collect results

    GET the job until its state is JobComplete or Failed, then pull successfulResults, failedResults and unprocessedrecords.

    Watch for: a job that finishes with failed rows still reports JobComplete. Read failedResults every time, and route those rows to someone.

Where Salesforce REST API integrations go wrong

The integration runs as a System Administrator

How you'll know: It works, and it can also delete anything in the org.

Fix: Run it as a dedicated integration user with a permission set limited to the objects and fields the job touches.

An expired session treated as a hard failure

How you'll know: The job dies overnight with INVALID_SESSION_ID and nobody knows until morning.

Fix: On a 401, get a new token (refresh it, or rerun the client credentials or JWT exchange) and retry the request once.

Pinned to an ancient API version

How you'll know: Calls suddenly return errors after a release.

Fix: Salesforce keeps versions for years but does retire them: versions 21.0 to 30.0 were retired in 2025. Move to a recent version and keep it in config, not scattered through code.

Polling for changes

How you'll know: Thousands of calls a day that mostly find nothing new.

Fix: Use Change Data Capture or platform events to be told about changes, and keep a light scheduled query only as a safety net.

Beyond the REST API

Most of what n-frames builds on the Salesforce REST API is the middle layer between your org and a system that doesn't have a deep Salesforce link: a form tool whose submissions should land as clean leads with campaign source and UTM data in the right fields, or a niche scheduling or ticketing tool with no AppExchange listing that has to stay in step with Salesforce records.

Inside Salesforce, logic that should run on save belongs in Salesforce Flow or Apex rather than in an outside script. Storefront APIs for B2C Commerce are a different system with their own auth, covered under Salesforce Commerce Cloud API. For hiring rather than building, see Salesforce developers.

Questions people ask

What's the difference between the Salesforce REST API and SOAP API?

Both work with the same Salesforce data. REST uses JSON over plain HTTP calls and is what almost all new integrations use. SOAP uses XML and a WSDL contract, and still turns up in older integrations and some enterprise tools built before REST was the default.

Do I need an API key to use the Salesforce API?

Not a static one. Salesforce authorizes API access with OAuth 2.0 tokens issued through an external client app (or an existing connected app). Access can be scoped to a user and permission set, and revoked without changing a shared secret everywhere.

What is the current Salesforce API version?

The number goes up with each of Salesforce's three yearly releases, and it's now in the high 60s. Call GET /services/data/ on your org to see exactly which versions it supports. Old versions keep working for years, but not forever.

Does Salesforce integrate with Outlook?

Yes. Salesforce's Outlook integration and Einstein Activity Capture log email and calendar activity against records. They don't push full record data both ways, so showing account details or creating records from Outlook in your own way needs a build on the REST API.

Can I connect Salesforce to a project management tool?

A few project tools have a native Salesforce connector for the basics; see Asana integrations for one example. Most don't, and keeping deals and projects in step usually means a custom integration on both APIs, where you choose exactly which fields and statuses sync.

How many API calls does a Salesforce org get per day?

Enterprise Edition gets 100,000 per rolling 24 hours plus 1,000 for each Salesforce license, with smaller amounts for other license types. Composite requests count as one call, which is the cheapest way to cut usage.

When should I use Bulk API 2.0 instead of REST?

Once a job touches thousands of records. Bulk API 2.0 takes a CSV, processes it asynchronously and gives back success and failure files, using far fewer calls than record-by-record REST.

Let's talk

Tell us the one thing your team does manually that eats up time. We read every message and reply within a day.