General

Companies

General Companies API documentation

Please note this page is under construction

Introduction

The companies API call is used to manage leads or accounts records on SwitchTransact.

Unlike the Contact Centre API call these changes will not go through a Approval process.

List Records

This API call will list all the records.

Path
POST /companies/list

JSON Body:

{
    "pagination": {
        "perpage": 100,
        "page": 1
    },
    "sort": {
        "field": "updated_at",
        "sort": "desc"
    },
    "query": {
        "generalSearch": "Inc Corp"
    }
}

All body parameters are optional.

The generalSearch parameter can be used to search records by company name, email, phone, customer/member number or registration number.

JSON Response:

{
    "meta": {
        "page": 1,
        "pages": 1,
        "perpage": 100,
        "total": 25,
        "sort": "desc",
        "field": "updated_at"
    },
    "data": [
        {
            "id": "6d6be205-b1da-4820-9cc8-e956ef070737",
            "name": "New Inc Corp",
            "trading_as": "New Inc Corp",
            "registration_number": "20142/182645/07",
            "member_number": "MEM123456",
            "email": "newinco@corp.com",
            "email_score": 96,
            "contact": "+2712345678",
            "mobile": "+27810445467",
            "fax": "+27123456789",
            "website": "https://mycompany.com",
            "date_closed": null,
            "postal_line_1": "123 Park Street",
            "postal_line_2": "Brooklyn",
            "postal_line_3": "Pretoria",
            "postal_line_4": "Gauteng",
            "postal_code": "0081",
            "physical_line_1": "123 Park Street",
            "physical_line_2": "Brooklyn",
            "physical_line_3": "Pretoria",
            "physical_line_4": "Gauteng",
            "physical_code": "0081",
            "is_taxable": true,
            "is_marketing_sms": true,
            "is_marketing_whatsapp": true,
            "is_marketing_email": true,
            "is_marketing_phone": true,
            "is_active": true,
            "tax_reference": "0123456789",
            "deal_value": 25457.54,
            "deal_accounts_currencies_id": "f34eb5cc-f6f7-4e9a-972e-bb57bff6c061",
            "deal_accounts_currencies_title": "ZAR",
            "deal_expected_close_date": "2030-01-01T00:00:00.000Z",
            "is_blacklisted": false,
            "total_successful_transactions": 57,
            "total_failed_transactions": 4,
            "total_subscriptions": 2,
            "total_subscriptions_products": 3,
            "total_active_subscriptions_products": 2,
            "call_last_contacted": "2024-03-25T15:45:54.845Z",
            "date_phone_invalid": null,
            "date_lead_conversion": "2005-12-26T00:00:00.000Z",
            "date_paid_up": "2024-05-01T00:00:00.000Z",
            "address_details_changed_at": "2024-03-16T00:00:00.000Z",
            "contact_details_changed_at": "2024-03-08T00:00:00.000Z",
            "last_engagement_at": "2024-03-26T12:05:15.845Z",
            "status_changed_at": "2024-04-01T04:16:55.551Z",
            "referred_by": "Marcus Black",
            "owner_admins": ["Henco Smith"],
            "call_last_contacted_by_agents_id": "21b27320-fcaa-4e23-af1f-72365c471640",
            "call_last_contacted_by_agents_title": "Martha Smith",
            "visible_to_id": "842e0539-3083-4e17-86c1-cf99e0243d24",
            "visible_to_title": "Record Owner(s)",
            "municipality_id": "be7b0599-321c-43d1-85f5-c4d2d6808969",
            "municipality_title": "City of Johannesburg",
            "source_of_record_id": "69689662-deb4-4513-9940-94afa442f720",
            "source_of_record_title": "Added",
            "tax_name": "VAT",
            "tax_value": "15.00",
            "type_title": "Private Limited Company",
            "country_title": "South Africa",
            "region_title": "Gauteng",
            "branch_title": "Head Office",
            "branches_regions_title": "Sandton",
            "branches_regions_id": "c07cca49-af09-4d0d-9755-4876c67e3f88",
            "agent_title": "Marie Jue",
            "image": "https://images.com/123",
            "social_facebook": "https://facebook.com/123",
            "social_linkedin": "https://linkedin.com/123",
            "social_instagram": "https://instagram.com/123",
            "social_twitter": "https://x.com/123",
            "social_pinterest": "https://pinterest.com/123",
            "social_blog": "https://blog.com/123",
            "social_whatsapp": "+27800000008",
            "social_telegram": "+27800000006",
            "created_at": "2022-06-23T12:29:33.305Z",
            "custom_fields": { 
              "Category": "Small",
              "Date Renew License": "2025-01-01",
            }
        },
        ...
    ]
}

All lookup values can be found under: Lookups API

Create Records

This API call will create a single record.

Path
POST /companies/create

JSON Body:

{
    "type_lookups_id": "f6cf9a30-b302-4ed9-a89c-1ccbe9889358",
    "name": "New Inc Corp",
    "trading_as": "New Inc Corp",
    "registration_number": "20142/182645/07",
    "member_number": "MEM123456",
    "email": "newinco@corp.com",
    "contact": "+2712345678",
    "is_active":true,
    "is_marketing_sms":true,
    "is_marketing_whatsapp":true,
    "is_marketing_email":true,
    "is_marketing_phone":true,
    "custom_fields": { 
        "Category": "Small",
        "Date Renew License": "2025-01-01",
    },
    ...
}

All body parameters are optional and shown under Body Fields.

Successful response:

{
  "record": {
    ...record object
  },
  "publicId": "b9daf9a724c305ebec2b0b2c763b......bd2dee8a8b0ca6adfbc5a753da0",
}

Error response:

{
  "status": false,
  "error": "Error message",
  "errors": {
    ...Validation error object
  }
}

Update Records

This API call will update a single record.

Path
POST /companies/update/{record_id}

JSON Body:

{
    "type_lookups_id": "f6cf9a30-b302-4ed9-a89c-1ccbe9889358",
    "name": "New Inc Corp",
    "trading_as": "New Inc Corp",
    "registration_number": "20142/182645/07",
    "member_number": "MEM123456",
    "email": "newinco@corp.com",
    "contact": "+2712345678",
    "is_active":true,
    "is_marketing_sms":true,
    "is_marketing_whatsapp":true,
    "is_marketing_email":true,
    "is_marketing_phone":true,
    "visible_to_lookups_id": "842e0539-3083-4e17-86c1-cf99e0243d24",
    "owner_admins_ids": ["2fb28f67-a39a-4642-9ce2-473e75c248c9", "d2abe74e-a5a2-47ba-85a5-5b14450c4ea0"],
    "custom_fields": { 
        "Category": "Small",
        "Date Renew License": "2025-01-01",
    },
    ...
}

All body parameters are optional and shown under Body Fields.

Successful response:

{
  "record": {
    ...record object
  },
  "publicId": "b9daf9a724c305ebec2b0b2c763b......bd2dee8a8b0ca6adfbc5a753da0",
}

Error response:

{
  "status": false,
  "error": "Error message",
  "errors": {
    ...Validation error object
  }
}

Body Fields

Below are all the fields for a record:

KeyTitle Case
agents_idAgents Id
balance_openBalance Open
balance_outstandingBalance Outstanding
branches_idBranches Id
contactContact
country_lookups_idCountry Lookups Id
custom_fieldsCustom Fields
date_balance_openDate Balance Open
date_closedDate Closed
day_billingDay Billing
deal_accounts_currencies_idDeal Accounts Currencies Id
deal_expected_close_dateDeal Expected Close Date
deal_valueDeal Value
default_accounts_currencies_idDefault Accounts Currencies Id
default_accounts_tax_idDefault Accounts Tax Id
faxFax
emailEmail
imageImage URL
is_activeIs Active
is_blacklistedIs Blacklisted
is_marketing_emailIs Marketing Email
is_marketing_phoneIs Marketing Phone
is_marketing_smsIs Marketing Sms
is_marketing_whatsappIs Marketing Whatsapp
is_taxableIs Taxable
member_numberMember Number
mobileMobile
municipality_lookups_idMunicipality Lookups Id
nameName
owner_admins_idsOwner Admins Ids
physical_codePhysical Code
physical_line_1Physical Line 1
physical_line_2Physical Line 2
physical_line_3Physical Line 3
physical_line_4Physical Line 4
postal_codePostal Code
postal_line_1Postal Line 1
postal_line_2Postal Line 2
postal_line_3Postal Line 3
postal_line_4Postal Line 4
referred_byReferred By
region_lookups_idRegion Lookups Id
registration_numberRegistration Number
role_lookups_idRole Lookups Id
social_facebookSocial Facebook
social_linkedinSocial Linkedin
social_instagramSocial Instagram
social_twitterSocial Twittter / X
social_pinterestSocial Pinterest
social_blogSocial Blog
social_whatsappSocial WhatsApp
social_telegramSocial Telegram
source_of_record_lookups_idSource Of Record
tax_referenceTax Reference
trading_asTrading As
type_lookups_idType Lookups Id
visible_to_lookups_idVisible To Lookups Id
websiteWebsite

All lookup values can be found under: Lookups API


Copyright © 2024 SwitchTransact