Skip to content
Funnel Science Documentation
  • Home
  • Documentation
    • API Reference
    • Website Integration
    • Web App
  • Search
  • Authentication
  • Create Lead
  • Create Interaction
  • Phone Calls
  • Leads
Authentication
JavaScript - Fetch
Response
Authentication

Before you can use the Funnel Science API, you must authenticate with the server to retrieve an authentication token.

This token is used to access the other functions of the API.

Commands:

  • function: login
  • email: Your Email Address
  • password: Your Password

Be sure to send this as a POST request, with a content type of multipart/form-data.

JavaScript - Fetch

const email = 'YOUR_EMAIL_ADDRESS';
const password = 'YOUR_PASSWORD';
const url = 'https://app.funnelscience.com/restapi.php';
var data = new FormData();
data.append("function", "login");
data.append("email", email);
data.append("password", password);
fetch(url, {
    method: 'POST',
    body: data,
    headers: {
        "Content-Type": "multipart/form-data",
        "cache-control": "no-cache",
    },
})
Response

{
    "token": "YOUR_AUTH_TOKEN",
    "userid": "999"
}
Create Lead
JavaScript - Fetch
Response
Create Lead

The “create_lead” function creates a new lead record in Funnel Science

Commands:

  • function: create_lead
  • token: Your Authentication Token
  • lead: JSON

Be sure to send this as a POST request, with a content type of multipart/form-data.

JavaScript - Fetch

Lead Types Are As Follows:

Form = 1
Phone = 2
WalkIn = 3
Referall = 4
ColdCall = 5
LeadList = 6
Email = 7
BusinessShow = 8
Billboard = 9
Networking = 10
Webchat = 11
TextMessage = 12
SocialMedia = 13
FunnelScience = 14
CallRequest = 15
API = 58

Example is for a Webchat lead:


var json = {"first_name": "John","last_name": "Smith","email": "john@yourdomain.com","type": "11","meta": {"message": "This lead created via API"}}
const url = 'https://app.funnelscience.com/restapi.php';
var data = new FormData();
data.append("function", "leads");
data.append("token", "YOUR_AUTH_TOKEN");
data.append("create_lead", json);
fetch(url, {
	method: 'POST',
	body: data,
	headers: {
		"Content-Type": "multipart/form-data",
		"cache-control": "no-cache",
	},
})
Response

Most of these values can be added via the JSON:


{
    "error": false,
    "message": "Success.",
    "leadCopy": {
        "client": "6",
        "stage": -1,
        "step": -1,
        "parent": -1,
        "type": "11",
        "company": null,
        "first_name": "John",
        "last_name": "Smith",
        "email": "john@yourdomain.com",
        "phone": null,
        "archived": 0,
        "assigned": null,
        "address1": null,
        "address2": null,
        "city": null,
        "state": null,
        "zip": null,
        "country": null,
        "score": null,
        "archive_reason": null,
        "lead_status": "Pending",
        "negative_keyword": null,
        "url": null,
        "enddate": null,
        "startdate": null,
        "agencyname": null,
        "mobile_phone": null,
        "future_date": null,
        "phone_ext": null,
        "phone2_ext": null,
        "phone2": null,
        "facebook": null,
        "instagram": null,
        "linkedin": null,
        "twitter": null,
        "contractstatus": null,
        "contractid": null,
        "timezone": null,
        "demostatus": null,
        "closer": null,
        "timesscraped": null,
        "citieslist": null,
        "title": null,
        "influencer": null,
        "decision_maker": null,
        "source": null,
        "medium": null,
        "saved_contract": null,
        "new_interactions": 1,
        "hunter": 0,
        "automation_email": 1,
        "automation_phone": 1,
        "automation_sms": 1,
        "industry": -1,
        "order": null,
        "recnum": RETURNED_RECORD_NUMBER,
        "date_created": null,
        "date_updated": null,
        "meta": {
            "message": "This lead created via API",
            "cvs": null,
            "cnum": null,
            "mum_message": null,
            "session": null,
            "visitor": null,
            "ip_address": null,
            "from_url": null
        }
    }
}
Create Interaction
JavaScript - Fetch
Response
Create Interaction

The “create_interaction” function creates a interaction attached to a lead record in Funnel Science.

Commands:

  • function: create_interaction
  • token: Your Authentication Token
  • lead: RECNUM
  • interaction: JSON

Be sure to send this as a POST request, with a content type of multipart/form-data.

JavaScript - Fetch

Interaction Types Are As Follows:

EMail = 1
Phone = 2
InPerson = 3
TextMessage = 4
SnailMail = 5
Ticket = 6
Invoice = 7
Chat = 8
Contract = 9
IncomingEMail = 10
Form = 101
Appointment = 103

Example is for a Webchat Interaction:


var json = {"type": "8","subject": "New Webchat Interaction","summary": "This is a test message."}
const url = 'https://app.funnelscience.com/restapi.php';
var data = new FormData();
data.append("function", "create_interaction");
data.append("token", "YOUR_AUTH_TOKEN");
data.append("lead", RECNUM);
data.append("interaction", json);
fetch(url, {
	method: 'POST',
	body: data,
	headers: {
		"Content-Type": "multipart/form-data",
		"cache-control": "no-cache",
	},
})
Response

{
    "error": false,
    "message": "Success.",
    "leadCopy": null
}
Phone Calls
JavaScript - Fetch
Response
Phone Calls

The “phone_calls” function retrieves a list of both incoming and outgoing phone calls within a given date range.

Commands:

  • function: phone_calls
  • token: Your Authentication Token
  • start_date: M/DD/YYYY format (No leading zeros)
  • end_date: M/DD/YYYY format

Be sure to send this as a POST request, with a content type of multipart/form-data.

JavaScript - Fetch

const url = 'https://app.funnelscience.com/restapi.php';
var data = new FormData();
data.append("function", "phone_calls");
data.append("token", "YOUR_AUTH_TOKEN");
data.append("start_date", "3/28/2019");
data.append("end_date", "3/28/2019");
fetch(url, {
    method: 'POST',
    body: data,
    headers: {
        "Content-Type": "multipart/form-data",
        "cache-control": "no-cache",
    },
})
Response

{
    "number_of_calls": 1,
    "phone_calls": [
        {
            "phone_route": "13",
            "phone_lease": "1641",
            "phone_session": "7294470",
            "sid": "CA5d3b7ed3c8a6893e7a40622a5751bbf4",
            "direction": "inbound",
            "call_status": "ringing",
            "caller_name": "A FENDER",
            "from_number": "+17754459847",
            "from_city": "CARSON CITY",
            "from_state": "NV",
            "from_zip": "89703",
            "from_country": "US",
            "to_number": "+18773010001",
            "to_city": null,
            "to_state": null,
            "to_zip": null,
            "to_country": "US",
            "transfered_to": null,
            "duration": "0",
            "duration_seconds": "0",
            "dial_sid": "CAd6d05be99c30162e110a5b0cdefAAAAA",
            "dial_duration": "1912",
            "dial_status": "completed",
            "recording_sid": "RE272d090cbd1238e8fae1c533edfAAAAA",
            "recording_duration": "1912",
            "recording_url": "https://api.twilio.com/2010-04-01/Accounts/ACbcdcdf3a2c2b43fa15397c1a91d730c7/Recordings/RE272d090cbd1238e8fae1c533edfAAAAA",
            "request_time": null,
            "action_time": {
                "date": "2019-03-28 13:34:24.000000",
                "timezone_type": 3,
                "timezone": "America/Chicago"
            },
            "status_time": null,
            "fallback_time": null,
            "error_code": null,
            "error_url": null,
            "api_version": "2010-04-01",
            "training": "0",
            "trainingcomments": null,
            "archived": "0",
            "assigned": "-1",
            "source": null,
            "medium": null,
            "archive_reason": null,
            "salesforceID": null,
            "repeat_caller": "outbound",
            "infusionID": null,
            "campaignid": null,
            "googletransfered": "0",
            "sentimentscore": "-0.00107",
            "transcription": "Thank you for calling to ensure the highest level of customer care this call maybe recorded.\n",
            "sentmag": "88.10000",
            "sentfull": "a:294:{i:0;a:2:{s:4:\"text\";a:2:{s:7:\"content\";s:92:\"Thank you for calling to ensure the highest level of customer care this call maybe recorded.\";s:11:\"beginOffset\";i:25123;}s:9:\"sentiment\";a:2:{s:9:\"magnitude\";d:0.20000000000000001;s:5:\"score\";d:-0.20000000000000001;}}}",
            "recnum": "313666",
            "date_created": {
                "date": "2019-03-28 13:02:32.000000",
                "timezone_type": 3,
                "timezone": "America/Chicago"
            },
            "date_updated": {
                "date": "2019-03-28 13:43:09.000000",
                "timezone_type": 3,
                "timezone": "America/Chicago"
            },
            "meta": {},
            "sessionsource": null,
            "sessionmedium": null,
            "keyword": null,
            "search_term": null,
            "routename": "Outgoing",
            "campaign": null,
            "sessioncampaignid": null,
            "sessionrequesturl": null
        },
    ]
}
Leads
JavaScript - Fetch
Response
Leads

The “leads” function retrieves a list of your current leads for a given date range.

Commands:

  • function: leads
  • token: Your Authentication Token
  • start_date: M/DD/YYYY format (No leading zeros)
  • end_date: M/DD/YYYY format

Be sure to send this as a POST request, with a content type of multipart/form-data.

JavaScript - Fetch

const url = 'https://app.funnelscience.com/restapi.php';
var data = new FormData();
data.append("function", "leads");
data.append("token", "YOUR_AUTH_TOKEN");
data.append("start_date", "3/28/2019");
data.append("end_date", "3/28/2019");
fetch(url, {
	method: 'POST',
	body: data,
	headers: {
		"Content-Type": "multipart/form-data",
		"cache-control": "no-cache",
	},
})
Response

{
    "number_of_leads": 1,
    "leads": [
        {
            "client": "6",
            "stage": "-1",
            "step": "-1",
            "parent": "0",
            "type": "45",
            "company": "somecompany",
            "first_name": null,
            "last_name": null,
            "email": "info@somecompany.com",
            "phone": "+14153456666",
            "archived": "0",
            "assigned": "-1",
            "address1": null,
            "address2": null,
            "city": "San Francisco",
            "state": "California",
            "zip": null,
            "country": null,
            "score": "55",
            "archive_reason": null,
            "lead_status": "Pending",
            "negative_keyword": null,
            "url": "www.somecompany.com",
            "enddate": null,
            "startdate": null,
            "agencyname": null,
            "mobile_phone": null,
            "future_date": null,
            "phone_ext": null,
            "phone2_ext": null,
            "phone2": null,
            "facebook": null,
            "instagram": null,
            "linkedin": null,
            "twitter": null,
            "contractstatus": null,
            "contractid": null,
            "timezone": "America/Los_Angeles",
            "demostatus": null,
            "closer": null,
            "recnum": "148087",
            "date_created": {
                "date": "2019-03-28 04:30:48.000000",
                "timezone_type": 3,
                "timezone": "America/Chicago"
            },
            "date_updated": null,
            "meta": {
                "message": "

Ad Headline: Coming Soon, SF | Modern Apartments For Sale
Full Ad Text: Join our Interest list! 1-, 2-, and 3-bedroom residences priced from the $500Ks. Register Online. Modern Living. Amenities: Communal Lobby Facilities, Landscaped Courtyard Facilities, Rooftop Terrace Facilities, BBQ Facilities.
Site Title: Some Company
Google Analytics: Found, (URL: www.somecompany.com)

Contacts Found:
Emails Found: info@somecompany.com
Phone Numbers Found: 415.345.6666

Socials Found:


Lead found at: https://www.google.com/search?q=apartments+for+rent+in+San+Francisco&ip=0.0.0.0&uule=w+CAIQICImU2FuIEZyYW5jaXNjbyxDYWxpZm9ybmlhLFVuaXRlZCBTdGF0ZXM&adtest=on&ie=UTF-8&prmd=ivns&ei=E5ScXPu9MeTWjwTR2YOQBA&start=10&sa=N
" } } ] }
Copyright © 2026 Funnel Science