Salesforce API and API Calls Usage

API Usage

By default, Skyvia uses Salesforce SOAP API to query data from Salesforce and Bulk API to load data to Salesforce. It doesn’t use Bulk API to query data from Salesforce because there is no any performance gain for selecting data. If Bulk API is not available for your account or you don’t want to use it, you can completely disable Bulk API use in the Advanced Settings by clearing the Use Bulk API checkbox.

API Calls for Loading Data to Salesforce

By default, Skyvia uses Bulk API to load data to Salesforce. It uses 1 API call per a batch of sent records. The number of records in a batch varies, and it greatly depends on the overall structure and complexity of a package, number of mapped fields, size of values in records, mapping, etc. The maximum size of a batch is 5,000, but usually it is significantly less than 5,000 records. In very complex cases it may be even just a few records.

If you opt to use SOAP API for loading data to Salesforce, Skyvia also loads data in batches, and all the information above is true. The only difference is maximum batch size, which is 200 records in case of SOAP API.

In import packages, running on the new data integration runtime, you can use the Batch Size option to better control the size of the batches. Note that if you set this option to a larger value than Salesforce API allows, the batch is split into multiple internal batches automatically.

API Calls for Querying Data from Salesforce

When Salesforce is used as a source, Skyvia uses the following number of API calls to query Salesforce data:

  • 1 API call per 2,000 records without custom long text area fields or with 1 such field;
  • 1 API call per 200 records when 2 or more custom long text fields are queried;
  • 1 API call per 1 Attachment record.

These numbers do not depend on the package structure and mapping, they only depend on how Salesforce returns records.

A synchronization or replication package queries modified Salesforce records and deleted Salesforce records separately, so it uses at least 2 API calls per task.

API Calls in Lookups to Salesforce

When you use lookup mapping in your packages, where a lookup object is a Salesforce object, we use an additional API call per a batch of maximum 50 records processed by a task for each lookup, even for multiple lookups to the same Salesforce object. The actual size of this batch depends on the overall structure and complexity of a package, number of mapped fields, size of values in records, mapping, etc.

If the above numbers, lengths, and complexity are high, the actual size of a batch may be less than 50. If you use a two-level lookup, 1 call per used lookup per batch is used.

The Use Cache lookup option may significantly affect API calls usage. Depending on the number of records loaded by the task and number of records in the lookup object, it may decrease or increase the number of API calls used.

When this checkbox is selected, Skyvia queries all the records from the lookup object first, spending API Calls as described above, in the API Calls for Querying Data section. Then lookups are performed over the cache, without using Salesforce API calls. Besides, if you use multiple lookups to the same Salesforce object in one task, records from this object are queried to the cache only once.

Please note that with this checkbox selected, 1 API call is used per a batch of 2,000 or 200 records (see above), and the total number of records from the lookup object determines the number of these batches. When it is NOT selected, 1 API call is used per a batch of up to 50 records, and the number of records processed by the task, determines the number of these batches.

Package Scheduling Considerations

Please note that an import or export package with Salesforce as a source uses at least 1 API call per task even when it does not process any records. If you schedule it to run every minute, it may use 1,440 API calls per task per day.

Replication or synchronization package uses at least 2 API calls per task for querying data from Salesforce: one — to query new and updated records, and another — to query deleted records. So, if you schedule such a package to run every minute, it may use 2,880 API calls per task per day, even if no records were modified and synchronized during this day.

API Calls in Backup

When backing up Salesforce data, Skyvia uses Salesforce API calls as described in the API Calls for Querying Data section above. Please note that every time a full backup is performed, and Skyvia queries all the data from backed up objects (unless you configured data filtering in backup package tasks).

When restoring Salesforce data, Skyvia uses Salesforce API calls as described in the API Calls for Loading Data to Salesforce section above. Note that if you compare backups and undo changes, batches are counted separately for each of the operations — inserting, updating, and deleting records. If you, for example, select and undo adding of 1 record, updating of 1 record, and deleting of 1 record, it will be 3 API calls, not one API call per batch of 3 records.

API Calls in Query

When you query Salesforce data, API calls are used as described in the API Calls for Querying Data section above (in batches of 2,000 or 200 records per API call). However, you should consider one moment — if a query is not that complex and can be translated to Salesforce SQL directly, only the records returned by the query are counted.

If a query is too complex, Skyvia will query all the data from the mentioned objects first and then performs query on its side. Thus, it may use a lot of API calls to query all the data from these objects.

When performing an INSERT statement, Skyvia uses one API call. When performing DELETE or UPDATE statement, first Skyvia queries all the records, matching the WHERE condition, as described above. After you apply changes, Skyvia applies them using 1 API call per a batch of up to 5,000 records for Bulk API, or per up to 200 records for SOAP API.

API Calls in Connect

If you create an OData endpoint to Salesforce data and query its data, API calls are used as described in the API Calls for Querying Data section. As well as in Query, if an OData query is not that complex and can be translated to Salesforce SQL directly, only the records returned by the query are counted. But if a query is too complex, Skyvia will query all the data from the mentioned objects first and then performs query on its side. Thus, it may use a lot of API calls to query all the data from these objects.

When you update Salesforce data via OData endpoint, no batches are used. 1 API call is used for creating, updating, or deleting each record.