Lead Types

Lead Types are ways of grouping Leads. A Lead can have a single Lead Type.

Get lead types

GET /lead-types

Query string parameters

  • include_bundled boolean - Whether to include lead types from bundles
    • default: false
  • enable_escalation boolean - Whether to include lead types that has escalation enabled.
    • default: null
  • Supports Pagination
  • Supports Searching

Response
Status code 200

{
  "data": [
    {
      "id": "31401e63-3c07-4035-b727-5040dc55ff8c",
      "name": "Interested Buyer",
      "description": "offer",
      "group_id": null,
      "team_id": null,
      "relations_paths": [
        {
          "id": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
          "name": "Case type",
          "is_sales_type": true,
          "activity_types": {
            "milestones": [
              {
                "id": "a203539b-f06c-442c-8ad0-f5a56f0615f6",
                "name": "Contract",
                "sort_order": 1,
                "set_status": "closed",
                "suggest_task_after": null,
                "template_id": null,
                "content_suggestions": [
                  {
                    "id": "17498b87-d835-4a97-9428-24ae1dcfd9a5",
                    "type": "email",
                    "name": "consectetur",
                    "subject": "Hi",
                    "content": "Hi\nSome text here!",
                    "template_ids": null,
                    "team_id": null
                  },
                  {
                    "id": "7447f327-5dae-4276-8a87-8c8a6c9ed793",
                    "type": "email",
                    "name": "lorem ipsum",
                    "subject": "Sed ultrices",
                    "content": "Sed ultrices nec purus erat",
                    "template_ids": null,
                    "team_id": null
                  }
                ],
                "extra_step": null,
                "additional_steps": null,
                "automated_communications": [],
                "chance_of_success": 100
              },
              {
                "id": "943cef92-f9b4-4fcb-b4e4-834f34915973",
                "name": "Milestone 2",
                "sort_order": 2,
                "set_status": "open",
                "suggest_task_after": null,
                "template_id": null,
                "content_suggestions": [
                  {
                    "id": "5d0a2b97-cec8-4e77-bb32-624ed9e6edc9",
                    "type": "email",
                    "name": "nulam",
                    "subject": "Vivavmus dapibus",
                    "content": "enim sit amet facilisis",
                    "template_ids": null,
                    "team_id": null
                  }
                ],
                "extra_step": [
                  {
                    "id": "de4bb6f0-b5f4-4a7d-940d-dbeef24e3ac0",
                    "sort_order": 1,
                    "name": "Bibendum"
                  },
                  {
                    "id": "c8c7c9d3-8f6b-4e35-9fad-726f1918cd8d",
                    "sort_order": 2,
                    "name": "nam-gravida"
                  }
                ],
                "additional_steps": null,
                "automated_communications": [],
                "chance_of_success": 30
              }
            ],
            "supportive": [
              {
                "id": "f4aaf74a-59c6-409b-8990-54b78eae1c75",
                "name": "Supportive",
                "sort_order": 2,
                "set_status": "open",
                "suggest_task_after": null,
                "template_id": null,
                "content_suggestions": [
                  {
                    "id": "fe7f4d0f-3b56-4a28-bc6e-3f7648ac52fb",
                    "type": "email",
                    "name": "ultricies",
                    "subject": "mauris",
                    "content": "Dapibus metus nisl vel odio. Nunc vitae",
                    "template_ids": null,
                    "team_id": null
                  },
                  {
                    "id": "b20c7a34-3821-47b5-a70c-f6a649b410ca",
                    "type": "letter",
                    "name": "quisque",
                    "subject": null,
                    "content": "interdum sem non egentas",
                    "template_ids": null,
                    "team_id": null
                  }
                ],
                "extra_step": [
                  {
                    "id": "86247236-dc8f-4d4c-b406-fed9d7db97c3",
                    "sort_order": 1,
                    "name": "maecenas"
                  },
                  {
                    "id": "bd41fe6b-49c0-4ac1-987a-65c0a8ff238a",
                    "sort_order": 2,
                    "name": "ligula"
                  },
                  {
                    "id": "3b71a00f-adca-43e2-8d2b-99e3a2d4e572",
                    "sort_order": 3,
                    "name": "nulam"
                  }
                ],
                "additional_steps": null,
                "automated_communications": [],
                "chance_of_success": 0
              },
              {
                "id": "f4aaf74a-409b-59c6-4a28-54b78eae1c75",
                "name": "Supportive",
                "sort_order": 3,
                "set_status": "declined",
                "suggest_task_after": null,
                "template_id": null,
                "content_suggestions": [
                  {
                    "id": "fe7f4d0f-a70c-4a28-3821-3f7648ac52fb",
                    "type": "email",
                    "name": "lorem",
                    "subject": "ipsum",
                    "content": "ka passa",
                    "template_ids": null,
                    "team_id": null
                  },
                  {
                    "id": "fc0c7a34-4a28-47b5-a70c-f6a649b410ca",
                    "type": "email",
                    "name": "Lorem ipsum",
                    "subject": null,
                    "content": "Class aptent taciti socosqu",
                    "template_ids": null,
                    "team_id": null
                  }
                ],
                "extra_step": [
                  {
                    "id": "86247236-4d4c-b406-dc8f-fed9d7db97c3",
                    "sort_order": 1,
                    "name": "Declined because of something"
                  },
                  {
                    "id": "3441fe6b-4ac1-49c0-987a-65c0a8ff238a",
                    "sort_order": 2,
                    "name": "Declined because of something other"
                  },
                  {
                    "id": "3b71a00f-8d2b-43e2-adca-99e3a2d4e572",
                    "sort_order": 3,
                    "name": "Etiam dapibus"
                  }
                ],
                "additional_steps": null,
                "automated_communications": [],
                "chance_of_success": 0
              }
            ]
          },
          "team_id": null,
          "group_id": null,
          "created_at": "2015-03-04 11:51:19",
          "updated_at": "2015-03-05 08:47:27"
        }
      ],
      "escalation_accept": 86400,
      "escalation_activity": 86400,
      "disabled": false,
      "enable_escalation": true,
      "enable_team_settings": false,
      "escalation_active": [
        {
          "day_of_week": 0,
          "closed": true,
          "open": "13:08:06",
          "close": "14:10:37"
        },
        {
          "day_of_week": 1,
          "closed": false,
          "open": "21:10:40",
          "close": "15:33:16"
        },
        {
          "day_of_week": 2,
          "closed": false,
          "open": "12:28:19",
          "close": "12:12:00"
        },
        {
          "day_of_week": 3,
          "closed": false,
          "open": "10:16:56",
          "close": "17:37:48"
        },
        {
          "day_of_week": 4,
          "closed": false,
          "open": "15:25:50",
          "close": "09:04:30"
        },
        {
          "day_of_week": 5,
          "closed": false,
          "open": "01:29:40",
          "close": "03:26:00"
        },
        {
          "day_of_week": 6,
          "closed": false,
          "open": "03:32:12",
          "close": "01:16:08"
        }
      ],
      "lead_count": 22,
      "escalates_at": null,
      "sort_order": 0,
      "created_at": "2017-05-01 06:17:38",
      "updated_at": "2017-05-09 17:32:45"
    }
  ]
}

Create lead type

POST /lead-types

Parameters

  • name string
    • Required
  • description string
    • Required
  • relations_pathsarray
    • Required
    • relations_paths.* UUID
  • escalation_accept integer - See Escalation durations
  • escalation_activity integer - See Escalation durations
  • escalation_active array - See Escalation durations
    • escalation_active.*.day_of_week integer
      • Required
      • Between 0 and 6
    • escalation_active.*.closed boolean
      • Required
    • escalation_active.*.open date
      • Required if escalation_active.*.closed is false
      • H:i:s format
    • escalation_active.*.close date
      • Required if escalation_active.*.closed is false
      • H:i:s format
  • enable_escalation boolean
  • enable_team_settings boolean
  • disabled boolean
  • users array
    • users.*.id integer
      • Required
    • users.*.escalation_notifications boolean
    • users.*.assignment_notifications boolean

Escalation durations

Durations are in seconds.

  • escalation_accept will trigger an escalation if the lead is not accepted by a team within that duration.
  • escalation_activity will trigger when an activity is created on the case created by the accepted lead.

For example, if a Lead is created with a Lead Type that has escalation_accept set to 7200, the Lead will be marked as escalated when it hasn't been accepted within 7200 seconds (i.e. 2 hours).

Escalation active hours

For each day of the week, "opening hours" for escalations can be defined. If an escalation is processed when the day is "closed", it will be ignored.

The day_of_week property is zero-indexed and starts on Sunday, e.g. Sunday is 0, Saturday is 6. If closed is true, the whole day is closed. Otherwise, if false, the open and close times can be defined, or be set to null to be open the whole day. open and close is 24-hour based, e.g. 18:00:00 for 6pm.

In the following example, Monday-Thursday is open from 08:00 to 16:00, Friday is 09:00 to 15:30, and weekends are closed. Any escalations occurring on Fridays at 15:31 to Monday at 07:59 will be processed Monday morning at 08:00, so escalation responsible users will receive a notification, and the Lead is marked as escalated.

Payload

{
  "name": "Website leads",
  "description": "lorem ipsum dolor sit amet",
  "relations_paths": [
    "9eae431b-3d0f-4528-9c59-e9d1a40fcd04"
  ],
  "escalation_accept": 86400,
  "escalation_activity": 172800,
  "escalation_active": [
    {
      "closed": false,
      "open": "08:00:00",
      "close": "16:00:00",
      "day_of_week": 1
    },
    {
      "closed": false,
      "open": "08:00:00",
      "close": "16:00:00",
      "day_of_week": 2
    },
    {
      "closed": false,
      "open": "08:00:00",
      "close": "16:00:00",
      "day_of_week": 3
    },
    {
      "closed": false,
      "open": "08:00:00",
      "close": "16:00:00",
      "day_of_week": 4
    },
    {
      "closed": false,
      "open": "09:00:00",
      "close": "15:30:00",
      "day_of_week": 5
    },
    {
      "closed": true,
      "day_of_week": 6
    },
    {
      "closed": true,
      "day_of_week": 0
    }
  ],
  "disabled": false
}

Response
Status code 201

{
  "id": "b151c11f-f634-49e0-8b27-b274dfa55199",
  "name": "Website leads",
  "description": "lorem ipsum dolor sit amet",
  "relations_paths": [
    {
      "id": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
      "name": "Sales Path",
      "is_sales_type": true,
      "activity_types": {
        "milestones": [],
        "supportive": []
      },
      "team_id": null,
      "group_id": null,
      "created_at": "2015-03-04 11:51:19",
      "updated_at": "2015-03-05 08:47:27"
    }
  ],
  "escalation_accept": 86400,
  "escalation_activity": 86400,
  "disabled": false,
  "enable_escalation": true,
  "enable_team_settings": false,
  "escalation_active": [
    {
      "day_of_week": 0,
      "closed": true,
      "open": "13:08:06",
      "close": "14:10:37"
    },
    {
      "day_of_week": 1,
      "closed": false,
      "open": "21:10:40",
      "close": "15:33:16"
    },
    {
      "day_of_week": 2,
      "closed": false,
      "open": "12:28:19",
      "close": "12:12:00"
    },
    {
      "day_of_week": 3,
      "closed": false,
      "open": "10:16:56",
      "close": "17:37:48"
    },
    {
      "day_of_week": 4,
      "closed": false,
      "open": "15:25:50",
      "close": "09:04:30"
    },
    {
      "day_of_week": 5,
      "closed": false,
      "open": "01:29:40",
      "close": "03:26:00"
    },
    {
      "day_of_week": 6,
      "closed": false,
      "open": "03:32:12",
      "close": "01:16:08"
    }
  ],
  "lead_count": 22,
  "escalates_at": null,
  "sort_order": 0,
  "created_at": "2017-05-01 06:17:38",
  "updated_at": "2017-05-09 17:32:45"
}

Update lead type

PUT /lead-types/:lead_type_id

Parameters

Payload

{
  "name": "Website leads has been updated",
  "description": "lorem ipsum dolor sit amet",
  "relations_paths": [
    "9eae431b-3d0f-4528-9c59-e9d1a40fcd04"
  ],
  "escalation_accept": 86400,
  "escalation_activity": 172800,
  "escalation_active": [
    {
      "closed": false,
      "open": "08:00:00",
      "close": "16:00:00",
      "day_of_week": 1
    },
    {
      "closed": false,
      "open": "08:00:00",
      "close": "16:00:00",
      "day_of_week": 2
    },
    {
      "closed": false,
      "open": "08:00:00",
      "close": "16:00:00",
      "day_of_week": 3
    },
    {
      "closed": false,
      "open": "08:00:00",
      "close": "16:00:00",
      "day_of_week": 4
    },
    {
      "closed": false,
      "open": "09:00:00",
      "close": "15:30:00",
      "day_of_week": 5
    },
    {
      "closed": true,
      "day_of_week": 6
    },
    {
      "closed": true,
      "day_of_week": 0
    }
  ],
  "disabled": false
}

Response
Status code 200

{
  "id": "b151c11f-f634-49e0-8b27-b274dfa55199",
  "name": "Website leads has been updated",
  "description": "lorem ipsum dolor sit amet",
  "relations_paths": [
    {
      "id": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
      "name": "Sales Path",
      "is_sales_type": true,
      "activity_types": {
        "milestones": [],
        "supportive": []
      },
      "team_id": null,
      "group_id": null,
      "created_at": "2015-03-04 11:51:19",
      "updated_at": "2015-03-05 08:47:27"
    }
  ],
  "escalation_accept": 86400,
  "escalation_activity": 86400,
  "disabled": false,
  "enable_escalation": true,
  "enable_team_settings": false,
  "escalation_active": [
    {
      "day_of_week": 0,
      "closed": true,
      "open": "13:08:06",
      "close": "14:10:37"
    },
    {
      "day_of_week": 1,
      "closed": false,
      "open": "21:10:40",
      "close": "15:33:16"
    },
    {
      "day_of_week": 2,
      "closed": false,
      "open": "12:28:19",
      "close": "12:12:00"
    },
    {
      "day_of_week": 3,
      "closed": false,
      "open": "10:16:56",
      "close": "17:37:48"
    },
    {
      "day_of_week": 4,
      "closed": false,
      "open": "15:25:50",
      "close": "09:04:30"
    },
    {
      "day_of_week": 5,
      "closed": false,
      "open": "01:29:40",
      "close": "03:26:00"
    },
    {
      "day_of_week": 6,
      "closed": false,
      "open": "03:32:12",
      "close": "01:16:08"
    }
  ],
  "lead_count": 22,
  "escalates_at": null,
  "sort_order": 0,
  "created_at": "2017-05-01 06:17:38",
  "updated_at": "2017-05-09 17:32:45"
}

Delete lead type

DELETE /lead-types/:lead_type_id

Response
Status code 204

Lead Type Team Settings

Update team settings

PUT /lead-types/:lead_type_id/settings

Each team can configure some attributes of Lead Types in their own way that will override the company-wide settings:

Only available to users with the opportunities right

Parameters

  • relations_pathsarray
    • Required
    • relations_paths.* UUID
  • escalation_accept integer
  • escalation_activity integer
  • escalation_active array - The "opening hours" for each weekday. See below.
    • See Escalation durations
    • escalation_active.*.day_of_week integer
      • Required
      • Between 0 and 6
    • escalation_active.*.closed boolean
      • Required
    • escalation_active.*.open date
      • Required if escalation_active.*.closed is false
      • H:i:s format
    • escalation_active.*.close date
      • Required if escalation_active.*.closed is false
      • H:i:s format
  • disabled boolean
  • users array
    • users.*.id integer
      • Required
    • users.*.escalation_notifications boolean
    • users.*.assignment_notifications boolean

Payload

{
  "disabled": true,
  "users": [
    {
      "id": 786,
      "escalation_notifications": true,
      "assignment_notifications": false
    },
    {
      "id": 787,
      "escalation_notifications": false,
      "assignment_notifications": true
    }
  ],
  "relations_paths": [
    "eabda55c-de1e-4544-99f3-19db2b686cbe"
  ],
  "escalation_accept": 86400,
  "escalation_activity": 86400,
  "escalation_active": [
    {
      "closed": false,
      "day_of_week": 6,
      "open": "08:00:00",
      "close": "13:00:00"
    },
    {
      "closed": true,
      "day_of_week": 5
    },
    {
      "closed": true,
      "day_of_week": 1
    }
  ]
}

Response
Status code 200

Get settings for specific team

GET /lead-types/:leadTypeId/settings/:teamId

Agencies can retrieve a team's settings for a lead type. For example: getting a list of users to contact in the case of an escalated lead.

Only available to users with the agency right

Response
Status code 200

{
  "data": [
    {
      "assignment_notifications": false,
      "escalation_notifications": true,
      "user": {
        "id": 786,
        "first_name": "Taurean",
        "last_name": "Ledner",
        "phone_number": "578.595.1147x347",
        "job_title": "Sales Executive",
        "email": "27Darren.Rowe@yahoo.com",
        "email_notifications": false,
        "profile_picture": "https://randomuser.me/api/portraits/thumb/women/woman/17.jpg",
        "company": {
          "id": 416,
          "name": "Langosh LLC",
          "billing": {
            "invoice_email": "zLemke@gmail.com",
            "address_1": "994 Balistreri Vista Suite 239",
            "address_2": "",
            "zip_code": "39046",
            "city": "McLaughlinburgh",
            "state": "",
            "country": null
          },
          "phone_number": "735.088.6599x682",
          "website": "http://www.Streich.com",
          "vat": "1234567890123456",
          "logo_1": null,
          "logo_2": null,
          "timezone": null,
          "locale": null,
          "language": {
            "code": "en",
            "name": "English"
          },
          "currency": null,
          "settings": {
            "b2c": {
              "allow": false,
              "default": false
            },
            "theme": "default",
            "product": {
              "mode": "advanced"
            },
            "default_account_id": null,
            "teams_can_create_relations_paths": true,
            "groups_can_create_relations_paths": true,
            "use_social_lookup": false
          },
          "plan": null,
          "created_at": "2016-08-18 09:08:14",
          "updated_at": "2016-08-18 09:08:14"
        },
        "created_at": "2016-08-18 09:08:14",
        "updated_at": "2016-08-18 09:08:14"
      }
    },
    {
      "assignment_notifications": true,
      "escalation_notifications": false,
      "user": {
        "id": 787,
        "first_name": "Michelle",
        "last_name": "Beatty",
        "phone_number": "1-583-598-1273",
        "job_title": "Sales Executive",
        "email": "6148Marcelina.Crona@Baumbach.net",
        "email_notifications": false,
        "profile_picture": "https://randomuser.me/api/portraits/thumb/women/man/25.jpg",
        "company": {
          "id": 416,
          "name": "Langosh LLC",
          "billing": {
            "invoice_email": "zLemke@gmail.com",
            "address_1": "994 Balistreri Vista Suite 239",
            "address_2": "",
            "zip_code": "39046",
            "city": "McLaughlinburgh",
            "state": "",
            "country": null
          },
          "phone_number": "735.088.6599x682",
          "website": "http://www.Streich.com",
          "vat": "1234567890123456",
          "logo_1": null,
          "logo_2": null,
          "timezone": null,
          "locale": null,
          "language": {
            "code": "en",
            "name": "English"
          },
          "currency": null,
          "settings": {
            "b2c": {
              "allow": false,
              "default": false
            },
            "theme": "default",
            "product": {
              "mode": "advanced"
            },
            "default_account_id": null,
            "teams_can_create_relations_paths": true,
            "groups_can_create_relations_paths": true,
            "use_social_lookup": false
          },
          "plan": null,
          "created_at": "2016-08-18 09:08:14",
          "updated_at": "2016-08-18 09:08:14"
        },
        "created_at": "2016-08-18 09:08:14",
        "updated_at": "2016-08-18 09:08:14"
      }
    }
  ],
  "relations_paths": [
    {
      "id": "eabda55c-de1e-4544-99f3-19db2b686cbe",
      "name": "General sales",
      "is_sales_type": false,
      "activity_types": {
        "milestones": null,
        "supportive": null
      },
      "team_id": null,
      "group_id": null,
      "created_at": "2016-08-18 09:08:14",
      "updated_at": "2016-08-18 09:08:14"
    }
  ],
  "disabled": true,
  "escalation_accept": 86400,
  "escalation_activity": 86400,
  "escalation_active": [
    {
      "day_of_week": 1,
      "closed": true,
      "open": null,
      "close": null
    },
    {
      "day_of_week": 5,
      "closed": true,
      "open": null,
      "close": null
    },
    {
      "day_of_week": 6,
      "closed": false,
      "open": "08:00:00",
      "close": "13:00:00"
    }
  ]
}

Get Leads by Lead Type

GET /lead-types/:lead_type_id/leads

This is primarily intended for the Opportunities section in the application, and displays unaccepted leads assigned to the current team of the user.

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": "177a16d3-fbe1-4186-bfbc-51925de2557c",
      "user_id": 0,
      "lead_type_id": "990f3e13-d891-460e-82da-5af3a223b6b3",
      "b2c": true,
      "interest": "dolores ipsa voluptas",
      "lead_source": null,
      "lead_data": null,
      "rejections": null,
      "acceptions": null,
      "assignments": null,
      "escalations": null,
      "case_id": null,
      "account_id": null,
      "account": {
        "fixed_fields": [
          {
            "field_id": 9,
            "text_value": "Lakin Inc"
          }
        ],
        "custom_fields": [
          {
            "field_id": 7,
            "text_value": "Wayne.Hartmann@Hauck.com"
          }
        ]
      },
      "contact_id": null,
      "contact": {
        "fixed_fields": [
          {
            "field_id": 18,
            "text_value": "Freeman"
          },
          {
            "field_id": 19,
            "text_value": "Cruickshank"
          },
          {
            "field_id": 21,
            "numeric_value": 69122283
          }
        ],
        "custom_fields": [
          {
            "field_id": 13,
            "text_value": "Velva38@yahoo.com"
          }
        ]
      },
      "created_at": "2015-05-25 05:30:20",
      "updated_at": "2015-05-25 05:30:20"
    }
  ],
  "pagination": {
    "total": 10,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  }
}

Sort lead types

PUT /lead-types/sort

Only available for admins. You can combine this with sorting of lead type bundles.

Parameters

  • lead_types array
    • Required without lead_type_bundles
    • lead_types.*.id UUID
      • Required
    • lead_types.*.sort_order integer
      • Required
      • Minimum 0
  • lead_type_bundles array
    • Required without lead_types
    • lead_type_bundles.*.id integer
      • Required
    • lead_type_bundles.*.sort_order integer
      • Required
      • Minimum 0

Payload

{
  "lead_types": [
    {
      "id": "01e6b3ba-8673-41ba-8604-4d3959e03778",
      "sort_order": 1
    }
  ]
}

Response
Status code 204