YSUITE Lead API Integration Guide

Base URL: https://api.ysuite.org/v1/leads

This API allows your website forms (e.g., Contact Us, Get a Quote, Book a Demo, etc.) to automatically send new leads to your YSUITE CRM account in real-time.

1. Authentication

Each organization receives:

• x-ysuite-access-key → passed as a request header
• x-ysuite-secret-key→ passed as a request header

Actual Access Key and Secret will be shared separately.

2. Request Format

Method: POST
Headers:
Content-Type: application/json

Body Example (JSON):

{
  "lead_name": "John Doe",
  "lead_address": "London",
  "lead_email": "john@johndoe.com",
  "lead_phone": "+971501234567",
  "lead_source": "example.com",
  "lead_industry": "oil and gas",
  "lead_company_name": "ABC",
  "webiste": "johndoe.com",
  "description": "I am interested in Example.",
  "brand_id": "112321" //optional
}

3. Example Integrations

A. WordPress (Contact Form 7)

Add the following PHP snippet to your theme’s functions.php file to automatically send form data to YSUITE upon submission:

add_action('wpcf7_mail_sent', 'ysuite_send_to_api');
function ysuite_send_to_api($contact_form) {
$access_key = 'EAKIA7AsBCDEF123';
$secret_key = 'q8T7d1hG7xK1zF9W3kJ0hM8u2R1b';
$url = "https://api.ysuite.org/v1/leads";

$submission = WPCF7_Submission::get_instance();
if ($submission) {
$data = $submission->get_posted_data();
$payload = [
"lead_name" => sanitize_text_field($data['your-name']),
"lead_email" => sanitize_email($data['your-email']),
"lead_phone" => sanitize_text_field($data['your-phone']),
"lead_source" => "Website Contact Form"
];
$response = wp_remote_post($url, [
'headers' => [
'Content-Type' => 'application/json',
'x-ysuite-access-key' => $access_key,
'x-ysuite-secret-key' => $secret_key,
],
'body' => wp_json_encode($payload),
'timeout' => 10,
'method' => 'POST'
]);
}
}

B. Custom PHP Form

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $access_key = 'EAKIA7AsBCDEF123';
$secret_key = 'q8T7d1hG7xK1zF9W3kJ0hM8u2R1b';
$url = "https://api.ysuite.org/v1/leads";
    $data = [
        "lead_name" => $_POST['name'],
        "lead_email" => $_POST['email'],
        "lead_phone" => $_POST['phone'],
        "lead_source" => "Website Form"
    ];
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_POST => 1,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_HTTPHEADER => [
            "Content-Type: application/json",
            "x-ysuite-access-key: $access_key"
            "x-ysuite-secret-key: $secret_key"
        ],
        CURLOPT_POSTFIELDS => json_encode($data)
    ]);
    $response = curl_exec($ch);
    curl_close($ch);
}


       

4. Security Guidelines

• Keep Secret private — do not expose it in frontend JavaScript.
• Always send API requests from your backend (PHP, Node, etc.).
• HTTPS is required.

5. Troubleshooting

• 401 Unauthorized → Invalid Access Key
• 403 Forbidden → Invalid Secret
• 400 Bad Request → Missing required fields
• 500 Internal Error → Network or API issue

6. Support

For configuration assistance, raise a support ticket or contact us.

Leave a Reply

Your email address will not be published. Required fields are marked *