Download OpenAPI specification:Download
Earlier API version documentation: v1
Version 2 primarily focuses on aligning the data models between the GET, POST, and PUT endpoints of specific models (such as leads). With this change, our goal is to allow you to use the same data classes for the bodies of all similar types of requests.
The Hustle Public API exposes a RESTful interface to provide programmatic access to resources within your Hustle account. The API is defined using the OpenAPI specification (aka Swagger) which can be downloaded above and used to generate a client in various languages. This may help speed up integration with the API, but is not required. We recommend reading through the following sections to get familiar with how the API is structured before moving on to the API Reference.
Your server-side script or backend application must authenticate to create an access token. Access tokens are used to authorize requests that read and write Hustle resources. To authenticate use your Hustle provided client_id and client_secret to make a request following the OAuth2 client credentials flow. For example, using curl:
curl -s -XPOST 'https://api.hustle.com/v2/oauth/token' \ -H'Content-Type: application/json' \ -d @- << EOF | jq { "grant_type": "client_credentials", "client_id": "[email protected]", "client_secret": "thisisnotarealclientsecret" } EOF{ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOi...(truncated)", "scope": "read:account write:account", "expires_in": 7200, "token_type": "Bearer" }
Once authenticated, the access_token can be used in the authorization header as a bearer token for requests to Hustle resources:
Authorization: Bearer <access-token>where <access-token> is from the create access token response.
Access tokens are JSON Web Tokens (JWT) and are valid for two hours (7200 seconds). It is unlikely a script would have to handle an expired token assuming the script creates a new access token each time it runs. However, long running processes such as a backend application will need to create a new access token upon receiving an unauthenticated error (http status code 401). In this case the request should be retried with the new access token.
Every response from the api, including errors, will be returned as JSON in the body of the response and the content-type header set accordingly to application/json. Successful responses returning a single resource will contain the following fields at a minimum:
{ "id": String, "type": String, "createdAt": String }where id is Hustle's unique indentifier for the resource, type is the resource type and createdAt is an ISO 8601 formatted string.
Responses returning a list of resources will be returned as an array containing single resource objects as described above, in addition to a nested object for pagination details. For example:
{ "items": Array<Object>, "pagination": { "cursor": String, "hasNextPage": Boolean, "total": Number } }where items is an array of resources and pagination is an object with paging details. For more information on how pagination works, review the Pagination section below.
Error responses will always contain the following fields:
{ "code": Number, "message": Boolean }where code is the error code, usually the http status code, and message will explain what went wrong.
The pagination object briefly described above has information that can be used in subsequent requests to receive the next page of results for list responses. To get the next page pass the cursor as a query parameter in the next request. Optionally you can pass a limit as a query parameter to receive more data per page. The current default limit is 100 results and the max limit is 1000 results, but please note these values may change. The following is an example using limit and cursor to page through a result set:
curl -s -XGET 'https://api.hustle.com/v2/organizations?limit=1' \ -H'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOi...(truncated)' | jq{ "items": [ { "id": "YGkEfkzz5V", "type": "Organization", "name": "Campaign One", "createdAt": "2019-07-12T03:57:41.869Z" } ], "pagination": { "cursor": "WzEsMV0", "hasNextPage": true, "total": 2 } }
curl -s -XGET 'https://api.hustle.com/v2/organizations?limit=1&cursor=WzEsMV0' \ -H'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOi...(truncated)' | jqThe hasNextPage field can be used to determine if paging should continue. The total is the number of resources in the entire result set.{ "items": [ { "id": "raz9baExYJ", "type": "Organization", "name": "Campaign Two", "createdAt": "2019-07-17T17:50:40.502Z" } ], "pagination": { "cursor": "WzEsMl0", "hasNextPage": false, "total": 2 } }
Access to the API will be limited to 25 requests per second for endpoints returning resources. When this limit is reached the API will return an error and the request will need to be retried.
Creating an access token is an exception in that it only limits the number of failed attempts to create an access token. After 10 failed attempts to create an access token the ip of the request will be blocked for some period of time, but only for the account in question. Additionally 100 failed attempts in a 24-hour period will result in the requester's ip being blocked.
Create an access token. A valid access token is required to make requests to other endpoints.
grant_type required | string Value: "client_credentials" |
client_id required | string <email> |
client_secret required | string |
Returns an access token and some metadata about the token
Malformed request
Not authorized
Server error
Production Public API
Add an agent to a group.
groupId required | string |
name required | string |
fullName required | string |
phoneNumber required | string |
sendInvite | boolean Default: false |
string <email> |
Successfully created agent
Malformed request
Invalid access token
Group not found
Server error
Production Public API
Retrieve all agents in a group.
groupId required | string |
cursor | string |
limit | integer |
Returns a list of agents in the group.
Malformed request
Invalid access token
Group not found
Server error
Production Public API
Retrieve an agent by id.
agentId required | string |
Returns an agent.
Malformed request
Invalid access token
Agent not found
Server error
Production Public API
Update an agent.
agentId required | string |
name | string |
fullName | string |
sendInvite | boolean Default: false |
Returns an agent.
Malformed request
Invalid access token
Agent not found
Server error
Production Public API
Retrieve all organizations for the account.
cursor | string |
limit | integer |
Returns a list of organizations
Malformed request
Invalid access token
Server error
Production Public API
Retrieve an organization by id.
organizationId required | string |
Returns an organization
Malformed request
Invalid access token
Organization not found
Server error
Production Public API
Create a group
organizationId required | string |
name required | string |
countryCode required | string Enum: "US" "CA" "PR" |
location required | object |
Successfully created Group
Malformed request
Invalid access token
Organization not found
Server error
Production Public API
Retrieve an organization's groups.
organizationId required | string |
cursor | string |
limit | integer |
Returns a list of groups
Malformed request
Invalid access token
Groups not found
Server error
Production Public API
Retrieve a group by id.
groupId required | string |
Returns an organization
Malformed request
Invalid access token
Group not found
Server error
Production Public API
Create a lead and add it to a group or update a lead in a group. This operation is an upsert, and will update the fields of any leads that already exist in the group's parent organization with the associated phone number.
groupId required | string |
firstName required | string |
lastName | string |
string <email> | |
phoneNumber required | string Must be a valid phone number for your Organization's region. Hustle will not accept leads with fake phone numbers e.g. (555) 555-1212 You can check if a number is valid for your region using Google's libphonenumber. |
notes |