Overview
Welcome to the SalesDirector.ai API Documentation
This RESTful API speaks JSON. The API uses JSend type JSON responses to provide a consistent response format.
This API is stable, we will be actively adding more methods to this API regularly.
Any breaking changes made to the API will result in a new version of the API. Currently we are on version 1. You change the version in the URI such as /api/v1 or /api/v2, etc…
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
-H "Authorization: xxxxxxxxxxx"
Make sure to replace
xxxxxxxxxxxwith your API key.
SalesDirector.ai uses API keys to allow access to the API. To get an API key login into SalesDirector.ai and go to Setup -> API Keys -> and create a New API Key.
SalesDirector.ai expects for the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: xxxxxxxxxxx
Also Note you should access your API via your subdomain.
https://yyyyyyy.salesdirector.ai/api/v1/something
Opportunities
Get My Opportunities
curl "https://yyyyyyy.salesdirector.ai/api/v1/opportunities/my"
-H "Authorization: xxxxxxxxxxx"
The above command returns JSON structured like this:
{
"status": "success",
"data": [
{
"id": "a9799007-8ed2-4261-b5a8-1efbdc8bbc2b",
"active": "1",
"external_opp_id": "334j0HHBF",
"name": "Phone Install for Southern Railway",
"external_account_id": "333j055555",
"account": "Southern Railway",
"amount": 80000,
"close_date": {
"date": "2017-02-15 00:00:00.000000",
"timezone_type": 2,
"timezone": "PST"
},
"stage": "Develop",
"forecast": "upside",
"stage_system": "Develop",
"forecast_system": "upside",
"activity_index": 33,
"relationship_index": 50,
"type": "New Business",
"website": "http://www.southernrailway.com"
}
]
}
HTTP Request
GET https://yyyyyyy.salesdirector.ai/api/v1/opportunities/my
Upload/Update Opportunities
curl "https://yyyyyyy.salesdirector.ai/api/v1/admin/opportunities/upload" -F "file=@myfile.csv" -H "Authorization: xxxxxxxxxxx"
The above command returns JSON structured like this:
{
"status":"success",
"data":{
"total_imported_rows": 12,
"total_error_rows": 2,
"error_file": "https://app.salesdirector.ai/somebucket/mycompany-csv-opps-error-2017-02-28-13-42-36-84q1jp3u.csv",
"total_original_rows": 12
}
}
Upload / Update Opportunities via CSV file (batch process). Note: you must have Administrative permissions to perform this action.
Note: The unique key is the Opportunity ID. If we detect a new Opportunity ID in your CSV we will create a new opportunity, existing Opportunities will be Updated.
Supported Fields: Opportunity ID*, Opportunity Name*, Amount, Close Date, Stage, Opportunity Owner, Opportunity Owner Email, Account ID, Account Name, Account URL/Website, Opportunity Type, Next Step
The CSV file needs the first line to be a header line. Only 2 fields marked with a * are required, but we recommend as many as possible.
Note: 20MB File Max
HTTP Request
GET https://yyyyyyy.salesdirector.ai/api/v1/admin/opportunities/upload
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| send_error_email | false | If set to true, any errors will be emailed to the user |
Contacts
Upload/Update Contacts
curl "https://yyyyyyy.salesdirector.ai/api/v1/admin/contacts/upload" -F "file=@myfile.csv" -H "Authorization: xxxxxxxxxxx"
The above command returns JSON structured like this:
{
"status":"success",
"data":{
"total_imported_rows": 12,
"total_error_rows": 2,
"error_file": "https://app.salesdirector.ai/somebucket/mycompany-csv-contacts-error-2017-02-28-13-42-36-84q1jp3u.csv",
"total_original_rows": 12
}
}
Upload / Update Contacts via CSV file (batch process). These should be contacts associated with the Opportunities.
Note: you must have Administrative permissions to perform this action.
Supported Fields: Opportunity ID, Email*, Fullname, First Name, Last Name, Title, Company Name, Phone, Mobile Phone
The CSV file needs the first line to be a header line. The Opportunity ID is YOUR External Opportunity ID that you referenced in your Opportunity Upload.
HTTP Request
GET https://yyyyyyy.salesdirector.ai/api/v1/admin/contacts/upload
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| send_error_email | false | If set to true, any errors will be emailed to the user |
Sales Targets
Upload/Update Sales Targets
curl "https://yyyyyyy.salesdirector.ai/api/v1/admin/salestargets/upload" -F "file=@myfile.csv" -H "Authorization: xxxxxxxxxxx"
The above command returns JSON structured like this:
{
"status":"success",
"data":{
"total_imported_rows": 12,
"total_error_rows": 2,
"error_file": "https://app.salesdirector.ai/somebucket/mycompany-csv-forecast-error-2017-02-28-13-42-36-84q1jp3u.csv",
"total_original_rows": 12
}
}
Upload / Update Sales Targets (Sales Quotas) via CSV file (batch process). Note: you must have Administrative permissions to perform this action.
Fields we need are: Email Address of Salesrep, Month (date), Amount
The CSV file needs the first line to be a header line. All fields are required.
HTTP Request
GET https://yyyyyyy.salesdirector.ai/api/v1/admin/salestargets/upload
Query Parameters
| Parameter | Default | Description |
|---|---|---|
| send_error_email | false | If set to true, any errors will be emailed to the user |
Error Codes
| Error Code | Meaning |
|---|---|
| 400 | Bad Request – Usually an Invalid ID/URI |
| 401 | Unauthorized – Your API key is invalid |
| 404 | Not Found – The resource wasnt found |
| 500 | Internal Server Error – We had a problem with our server. Try again later. |
| 503 | Service Unavailable – We’re temporarily offline for maintenance. Please try again later. |