Note: When using the API to update a lead field, that value will always overwrite any existing field value and will not be added in addition to it.

Each SharpSpring partner is currently allotted 5,000 API requests per day by default, with a maximum of 500 queries per request. On average, users can add around 1 million contacts per day. However, requests may be rate-limited in times of high traffic and by volume of lead information. Be aware that the amount of API requests is subject to change in the future.

Generating API Keys

In order to access the SharpSpring API, you must generate both an account ID and an API key. The SharpSpring API currently does not support sessions, so these keys must be supplied during each request.

Note: You must be logged in to the SharpSpring application to view the linked content.

Using the SharpSpring API

Using the SharpSpring API to update a field value will always overwrite any existing field value. The overwrite will occur instead of appending to, adding to, or modifying the value in any other manner.

When you create a custom field, SharpSpring generates a system name, which is what you use in the API. However, if the name of the field is later changed, the system name will not change. This is to prevent accidentally breaking an API connection by changing a label.

For example, if a custom field is called Favorite Color, the system name may be Favorite_Color_5a0dd86e6e290. If the custom field is later changed Pet's Name in the UI, it will still be Favorite_Color_5a0dd86e6e290 in the API. At this point, it would be best to create a new field to avoid confusion.

Request and Response Format

Once your keys have been generated, you can begin creating the mechanism to retrieve and post data to and from the SharpSpring application. All requests are made using an HTTPs POST encoded in JSON. SharpSpring uses a standard very similar to JSON-RPC for request handling.

API Requests

Requests must be made to the following URL:https://api.sharpspring.com/pubapi/v1/

v1:

https://api.sharpspring.com/pubapi/v1/Time zone arguments passed to this endpoint will be handled based on the time zone setting selected in the Company Profile.

v1.2:

https://api.sharpspring.com/pubapi/v1.2/Time zone arguments passed to this endpoint will be handled in UTC.

API Authentication

Authentication parameters must be appended to the URL as query strings:accountID={account-id-here}&secretKey={secret-key-here}

Each request must contain the following three fields:

Method:

The name of the API method being called.

Params:

A parameters hash to be passed to the method.

ID:

A user-supplied request ID for correlating requests.

API Responses

Each API response contains the following three fields:

Result:

The return value of the method called. Usually a list of Objects and Object-level errors.

Error:

An API-level error returned by the API.

ID:

A user-supplied request ID for correlating requests.

The following is an example of using the getLead method to retrieve a single lead by its ID:

Object-Level Errors

When an invalid-format object is passed as part of a list (such as in a create or update query), an object-level error will be returned in the result array. Since the error was at the object level, no API errors will be returned.

502 Errors and Expect:100-Continue

If you experience a 502 error when running a call, check to see if Expect:100-continue is enabled in the header. SharpSpring uses Google's GCE service, and when the Expect:100-continue header is enabled, API calls longer than 1,024 characters (including the secret key and other data) will result in a 502 error. This option is on by default in .NET, as well as in .PHP.

Disabling Expect:100-Continue for .NET

To disable Expect:100-continue in .NET, run the following lines prior to the API call:

Disabling Expect:100-Continue for .PHP

To disable Expect:100-continue in Curl within .PHP, add the Expect option with no value to the HTTPHEADER section.

The last line in the below example shows how to disable Expect:100-continue in .PHP with this method: