Salesforce
The simplest Salesforce API you have ever seen!
TL;DR
This API proxy lets you do any operation on your Salesforce data but removes from you all the complexity of setting up and using the classic Salesforce API 🤩
No need to worry about setting up a connected app, rotating the security token, using bulk API or not, record formatting and more! Everything is managed for you 💆♀️
Operations:
Upsert records (tries to update a record and inserts it if it is not found)
Describe (reads instance or object metadata)
Regions 🌍
Depending on your region, you can use
🇪🇺 https://eu.api-proxy.stacksync.com/
🇺🇸 https://us.api-proxy.stacksync.com/
Insert
Insert up to 10 000 records with a single query. Simply supply the field values for each record you want to create. The response will contain one success confirmation per record meaning that, within the same request, each record can succeed or fail independently of each other. For each sent record, you will receive a detailed success or error message.
curl -X POST https://eu.api-proxy.stacksync.com/v1/object/insert/Account \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json" \
-d '{"data":[{"name": "John Doe"},{"name": "Jane Smith"}]}'import requests
object_name = 'Account'
url = f"https://eu.api-proxy.stacksync.cloud/v1/object/insert/{object_name}"
data ={
"data" :
[
{
'name': 'John Doe',
'site': 'example.com'
},
{
'name': 'Jane Smith',
'site': 'example.com'
}
]
}
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
const objectName = 'Account';
const url = `https://eu.api-proxy.stacksync.cloud/v1/object/insert/${objectName}`;
const data ={
data:
[
{
name: 'John Doe',
site: '[email protected]'
},
{
name: 'Jane Smith',
site: '[email protected]'
}
]
};
const apiProxyServiceToken = 'your_api_proxy_service_token';
const headers = {
'Authorization': `Bearer ${apiProxyServiceToken}`,
'Content-Type': 'application/json'
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
Example response body:
{
"data": [
{
"errors": [],
"id": "0010600002BpRZDAA3",
"success": true
},
{
"errors": [],
"id": "0010600002BpRZEAA3",
"success": true
}
]
}Upsert
Create or update (upsert) up to one record per request based on a match_key which can be the record Id or any custom field.
If the key is not matched, then a new object record is created.
If the key is matched once, then the existing object record is updated.
If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated.
curl -X POST https://eu.api-proxy.stacksync.com/v1/object/upsert/Account \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json" \
-d '{"data":[{"name":"Jon Doe"}],"match_key":"name"}'import requests
object_name = 'Account'
url = f"https://eu.api-proxy.stacksync.cloud/v1/object/upsert/{object_name}"
data = {
"data":
[
{
"name": "Jon Doe",
"site": "example.com"
}
],
"match_key": "name"
}
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
const object_name = 'Account';
const url = `https://eu.api-proxy.stacksync.cloud/v1/object/upsert/${object_name}`;
const data ={
data:
[
{
name: 'Jon Doe',
"site": "example.com"
}
],
match_key: "name"
};
const api_proxy_service_token = 'your_api_proxy_service_token';
const headers = {
'Authorization': `Bearer ${apiProxyServiceToken}`,
'Content-Type': 'application/json'
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
Example response body:
{
"data": [
{
"errors": [],
"id": "0010600002BpLWtAAN",
"success": true
}
]
}Update
Update up to 10 000 records per request. Existing field values in Salesforce will be overwritten with the new values provided.
curl -X POST https://eu.api-proxy.stacksync.com/v1/object/update/Account \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json" \
-d '{"data":[{"id": "0010600002BpLWtAAN", "name": "John Doe"}, {"id": "0010600002BpLWuAAN", "name": "Jane Smith"}]}'import requests
object_name = 'Account'
url = f"https://eu.api-proxy.stacksync.cloud/v1/object/update/{object_name}"
data ={
"data":
[
{
'id': '0010600002BpLWtAAN',
'name': 'John Doe',
'site': 'www.example.com'
},
{
'id': '0010600002BpLWuAAN',
'name': 'Jane Smith',
'site': 'www.example.com'
}
]
}
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
const objectName = 'Account';
const url = `https://eu.api-proxy.stacksync.cloud/v1/object/update/${objectName}`;
const data ={
data:
[
{
id: '0010600002BpLWtAAN',
name: 'John Doe',
site: 'www.example.com'
},
{
id: '0010600002BpLWuAAN',
name: 'Jane Smith',
site: 'www.example.com'
}
]
};
const apiProxyServiceToken = 'your_api_proxy_service_token';
const headers = {
'Authorization': `Bearer ${apiProxyServiceToken}`,
'Content-Type': 'application/json'
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
Example response body:
{
"data": [
{
"errors": [],
"id": "0010600002BpLWtAAN",
"success": true
},
{
"errors": [],
"id": "0010600002BpLWuAAN",
"success": true
}
]
}Delete
Delete up to 10 000 records per request.
curl -X POST https://eu.api-proxy.stacksync.com/v1/object/delete \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json" \
-d '{"data": {"ids":["0010600002BpLWtAAN","0010600002BpLWuAAN"]}}'import requests
url = f"https://eu.api-proxy.stacksync.cloud/v1/object/delete"
data ={
"data":
{
"ids" : ["0010600002BpLWtAAN","0010600002BpLWuAAN"]
}
}
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
const url = 'https://eu.api-proxy.stacksync.cloud/v1/object/delete';
const data ={
data :
{
ids : ['0010600002BpLWtAAN','0010600002BpLWuAAN']
}
};
const api_proxy_service_token = 'your_api_proxy_service_token';
const headers = {
'Authorization': `Bearer ${apiProxyServiceToken}`,
'Content-Type': 'application/json'
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
Example response body:
{
"data": [
{
"id" : "0010600002BpLWtAAN",
"success" : true,
"errors" : [ ]
},
{
"id" : "0010600002BpLWuAAN",
"success" : true,
"errors" : [ ]
}
]
}Get
Get the content of up to 10 000 records. The number of sObjects returned matches the number of Ids passed in the request.
You can pass the optional fields parameter (list of field names that you want to be returned for each record). If the list of fields is not passed or is empty "fields":[], all fields are returned.
curl -X POST https://eu.api-proxy.stacksync.com/v1/object/get/Account \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json" \
-d '{"data": {"ids": ["0010600002BpLWuAAN", "0010600002BpLWtAAN"], "fields": ["Name"]}}'import requests
object_name = 'Account'
url = f"https://eu.api-proxy.stacksync.cloud/v1/object/get/{object_name}"
data ={
"data":
{
"ids" : ["0010600002BpLWuAAN", "0010600002BpLWtAAN"],
"fields" : ["Name"]
}
}
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
const object_name = 'Account';
const url = `https://eu.api-proxy.stacksync.cloud/v1/object/get/${object_name}`;
const data ={
data:
{
ids: ["0010600002BpLWuAAN", "0010600002BpLWtAAN"],
fields: ["Name"]
}
};
const api_proxy_service_token = 'your_api_proxy_service_token';
const headers = {
'Authorization': `Bearer ${apiProxyServiceToken}`,
'Content-Type': 'application/json'
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
Example response body:
{
"data": [
{
"Id": "0010600002BpLWuAAN",
"Name": "John Doe",
"attributes": {
"type": "Account",
"url": "/services/data/v57.0/sobjects/Account/0010600002BpLWuAAN"
}
},
{
"Id": "0010600002BpLWtAAN",
"Name": "Jane Smith",
"attributes": {
"type": "Account",
"url": "/services/data/v57.0/sobjects/Account/0010600002BpLWtAAN"
}
}
]
}SOQL
Executes an SOQL query on your Salesforce instance.
curl -X POST https://eu.api-proxy.stacksync.com/v1/object/soql \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json" \
-d '{"data": "SELECT Id, Name, Email FROM Contacts"}'import requests
url = f"https://eu.api-proxy.stacksync.cloud/v1/object/soql"
data = {
'data': 'SELECT Id, Name, Email FROM contacts'
}
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)const url = "https://eu.api-proxy.stacksync.cloud/v1/object/soql";
const data = {
data: "SELECT Id, Name, Email FROM contacts",
};
const api_proxy_service_token = "your_api_proxy_service_token";
const headers = {
"Authorization": `Bearer ${apiProxyServiceToken}`,
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((data) => {
console.log(data);
})
.catch((error) => {
console.error(error);
});
Describe Salesforce Instance
Retrieves metadata for the Salesforce instance, containing a list of every available objects.
curl -X POST https://eu.api-proxy.stacksync.com/v1/describe \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json"import requests
url = f"https://eu.api-proxy.stacksync.cloud/v1/describe"
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)const url = "https://api-proxy.stacksync.cloud/v1/describe";
const api_proxy_service_token = "your_api_proxy_service_token";
const headers = {
"Authorization": `Bearer ${apiProxyServiceToken}`,
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers
})
.then((response) => response.json())
.then((data) => {
console.log(data);
})
.catch((error) => {
console.error(error);
});
Describe Object
Retrieves the metadata for a specific Salesforce table.
curl -X POST https://eu.api-proxy.stacksync.com/v1/describe/{object_name} \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json"import requests
object_name = "Account"
url = f"https://eu.api-proxy.stacksync.cloud/v1/describe/{object_name}"
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)const objectName = "Account";
const url = `https://eu.api-proxy.stacksync.cloud/v1/describe/${objectName}`;
const apiProxyServiceToken = "your_api_proxy_service_token";
const headers = {
'Authorization': `Bearer ${apiProxyServiceToken}`,
'Content-Type': 'application/json'
};
fetch(url, {
method: 'POST',
headers: headers
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
Add a custom field to a Salesforce object
Add a custom field to a Salesforce object. Standard and custom objects are supported
the required request body parameters are:
typethe type of the custom field you wish to createnamethe name of the custom field you wish to createlabelthe label associated to the custom field you wish to create
type can be any of the Fieldtypes presented here
Unless otherwise noted, all fields are creatable, filterable, and nillable.
some optional parameters may be required depending on the type,
(eg: length is required when creating a custom field of type Text)
Learn more about the API behavior here.
curl -X POST https://eu.api-proxy.stacksync.com/v1/object/add_custom_field/{object_name} \
-H "Authorization: Bearer your_api_proxy_service_token" \
-H "Content-Type: application/json" \
-d '{"data": {"name": "field_name", "type": "field_type", "label": "field_label"}}'import requests
headers = {
'Authorization': 'Bearer your_api_proxy_service_token',
# Already added when you pass json=
# 'Content-Type': 'application/json',
}
json_data = {
'data': {
'name': 'field_name',
'type': 'field_type',
'label': 'field_label'
},
}
response = requests.post(
'https://eu.api-proxy.stacksync.cloud/v1/object/add_custom_field/{object_name}',
headers=headers,
json=json_data,
)fetch('https://eu.api-proxy.stacksync.cloud/v1/object/add_custom_field/{object_name}'
method: 'POST',
headers: {
'Authorization': 'Bearer your_api_proxy_service_token',
'Content-Type': 'application/json'
},
// body: '{"data": {"field_name": "field_name", "field_type": "field_type"}}',
body: JSON.stringify({
'data': {
'field_name': 'field_name',
'field_type': 'field_type'
}
})
});Example Response Body:
{
"data": {
"errors": [],
"id": "01N7R00000FlUGDUA3",
"infos": [],
"success": true,
"warnings": []
},
"msg": "custom field added successfully"
}Example requests for different field types:
curl -X POST https://eu.api-proxy.stacksync.com/v1/object/add_custom_field/{object_name} \
-H "Authorization: Bearer *****" \
-H "Content-Type: application/json" \
-d '{"data":
{"name": "field_name",
"type": "Text",
"label": "list_field",
"length":100}}'Example:
curl -X POST
https://eu.api-proxy.stacksync.cloud/v1/object/add_custom_field/{object_name} \
-H "Authorization: Bearer ******" \
-H "Content-Type: application/json" \
-d '{
"data": {
"name": "picklistField",
"type": "Picklist",
"label": "picklistField",
"valueSet": {
"restricted": false,
"valueSetDefinition": {
"sorted": false,
"value": [
{
"fullName": "Option1",
"default": false
},
{
"fullName": "Option2",
"default": false
},
{
"fullName": "Option3",
"default": false
}
]
}
}
}
}'Pass Through
Make a request to any Salesforce API by providing the URL, Request Method and the Request Body.
A request will be sent to the URL provided using the request method and request body. The request body can be empty.
curl -X [GET | POST | PUT | PATCH | DELETE]
https://eu.api-proxy.stacksync.com/v1/proxy/INSERT_REQUEST_URL_HERE \
-H "Authorization: Bearer your_api_proxy_service_token" \
-d 'Optional'Example request:
Get Account Record
curl -X GET https://eu.api-proxy.stacksync.com/v1/proxy/https://MyDomainName.my.salesforce.com/services/data/v60.0/sobjects/Account/0017S00000GYoL3QAL \
-H "Authorization: Bearer your_api_proxy_service_token" import requests
url = "https://eu.api-proxy.stacksync.cloud/v1/proxy/https://MyDomainName.my.salesforce.com/services/data/v60.0/sobjects/Account/0017S00000GYoL3QAL"
api_proxy_service_token = "your_api_proxy_service_token"
headers = {
'Authorization': f'Bearer {api_proxy_service_token}'
}
response = requests.get(url, headers=headers)
const url = `https://eu.api-proxy.stacksync.cloud/v1/proxy/https://MyDomainName.my.salesforce.com/services/data/v60.0/sobjects/Account/0017S00000GYoL3QAL`;
const api_proxy_service_token = 'your_api_proxy_service_token';
const headers = {
'Authorization': `Bearer ${apiProxyServiceToken}`
};
fetch(url, {
method: 'GET',
headers: headers
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
Example response:
{
"AccountNumber": "CD355118",
"AccountSource": null,
"Active__c": "Yes",
"AnnualRevenue": 5600000000.0,
"BillingAddress": {
"city": "New York",
"country": "test",
"geocodeAccuracy": null,
"latitude": 12.699999997,
"longitude": 12.8,
"postalCode": "123",
"state": "NY",
"street": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA"
},
"BillingCity": "New York",
"BillingCountry": "test",
"BillingGeocodeAccuracy": null,
"BillingLatitude": 12.699999997,
"BillingLongitude": 12.8,
"BillingPostalCode": "123",
"BillingState": "NY",
"BillingStreet": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA",
"CleanStatus": "Pending",
"CreatedById": "0057S000000WzYEQA0",
"CreatedDate": "2022-10-28T08:44:59.000+0000",
"CustomerPriority__c": "High",
"DandbCompanyId": null,
"Description": "World's third largest oil and gas company.",
"DunsNumber": null,
"Fax": "(212) 842-5501",
"Id": "0017S00000GYoL3QAL",
"Industry": "Energy",
"IsDeleted": false,
"Jigsaw": null,
"JigsawCompanyId": null,
"LastActivityDate": null,
"LastModifiedById": "0057S000000WzYEQA0",
"LastModifiedDate": "2024-01-25T11:28:30.000+0000",
"LastReferencedDate": "2024-02-12T01:58:55.000+0000",
"LastViewedDate": "2024-02-12T01:58:55.000+0000",
"MasterRecordId": null,
"NaicsCode": null,
"NaicsDesc": null,
"Name": "Dickenson plc 2",
"NumberOfEmployees": 145000,
"NumberofLocations__c": 34.0,
"OperatingHoursId": null,
"OwnerId": "0057S000000WzYEQA0",
"Ownership": "Public",
"ParentId": null,
"Phone": "12",
"PhotoUrl": "/services/images/photo/0017S00000GYoL3QAL",
"Rating": "Hot",
"SLAExpirationDate__c": "2023-05-24",
"SLASerialNumber__c": "6654",
"SLA__c": "Platinum",
"ShippingAddress": {
"city": "Paris",
"country": "France",
"geocodeAccuracy": null,
"latitude": null,
"longitude": null,
"postalCode": "75251",
"state": "q",
"street": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA"
},
"ShippingCity": "Paris",
"ShippingCountry": "France",
"ShippingGeocodeAccuracy": null,
"ShippingLatitude": null,
"ShippingLongitude": null,
"ShippingPostalCode": "75251",
"ShippingState": "q",
"ShippingStreet": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA",
"Sic": "4437",
"SicDesc": null,
"Site": "resr",
"SystemModstamp": "2024-01-25T11:28:31.000+0000",
"TickerSymbol": "UOS",
"Tradestyle": null,
"Type": "Customer - Direct",
"UpsellOpportunity__c": "Yes",
"Website": "http://www.uos.com",
"YearStarted": null,
"aaaa__c": null,
"api_token_test__c": null,
"attributes": {
"type": "Account",
"url": "/services/data/v60.0/sobjects/Account/0017S00000GYoL3QAL"
},
"encrypted_test__c": "XXXXXXXXXX",
"formula_test__c": 5600145000.0,
"geolocation_test__Latitude__s": 12.0,
"geolocation_test__Longitude__s": 32.0,
"geolocation_test__c": {
"latitude": 12.0,
"longitude": 32.0
},
"multipick_list__c": "string;string;12.541",
"percent_test__c": 5.0,
"picklisttestnow__c": null,
"randomfield__c": null,
"rich_text_test__c": null,
"rollup_test__c": 720000.0,
"test_custom_string5__c": "test",
"time_test__c": "00:15:00.000Z",
"url_test__c": "www.google.com"
}Last updated
