GET https://solarproof.com.au/apidata.php

Description

This endpoint allows you to retrieve a customer's ID and complete profile information using their email address. This is particularly useful when you have a customer's email but need to perform operations that require their customer ID (such as updating or deleting the customer).

Note: This endpoint returns the full customer object (identical to the Get Customer endpoint), not just the customer ID. You'll find the ID in the customer_id field.

Request Parameters

Query Parameters

Parameter Type Required Description
api_key string Required Your Solar Proof API key
action string Required Must be set to "getcustomerid"
customer_email string Required The email address of the customer you want to look up

Response

Success Response (200 OK)

Returns a complete customer object with all associated data including projects and notes.

Response Body JSON
{
  "customer_id": "71705",
  "gst_status": "Not GST Registered",
  "customer_first_name": "John",
  "customer_last_name": "Smith",
  "customer_phone_1": "0499399399",
  "customer_phone_2": "",
  "customer_email": "john.smith@example.com",
  "customer_type": "Residential",
  "company_name": "",
  "company_phone": "",
  "owner_user_info": {
    "user_id": "16",
    "first_name": "Chris",
    "last_name": "User",
    "phone_number": "0411 549 054",
    "email": "chris@solarproof.com.au",
    "work_title": "Director",
    "username": "cuser"
  },
  "creation_date": "2020-11-19",
  "customer_notes": [],
  "customer_status": "No Status Set",
  "projects": [
    {
      "project_id": "849",
      "project_title": "Project #849",
      "site_address": {
        "streetnum": "418",
        "street": "Murray Street",
        "suburb": "Perth",
        "state": "WA",
        "postcode": "6000",
        "country": "Australia"
      },
      "solar_panel_quantity": "56",
      "solar_panel_type": "320W - SUNPOWER - (SPR-E19-320)",
      "inverter_type": "SMA Australia 20kW (STP20000TL-30)",
      "inverter_quantity": "1",
      "system_size": "17.92kW",
      "proposal_link": ""
    }
  ]
}

Key Response Fields

Field Type Description
customer_id string The customer's unique ID - This is the primary value you're looking for
customer_email string The email address that was searched (confirms correct customer)
customer_first_name string Customer's first name
customer_last_name string Customer's last name
customer_type string "Residential", "Commercial", or "Large-Scale"
owner_user_info object Information about the user who created this customer
projects array Array of project objects associated with this customer
Tip: For a complete breakdown of all response fields, see the Get Customer documentation, as this endpoint returns identical data.

Error Response (4xx/5xx)

Error Response JSON
{
  "code": "CUSTOMER_NOT_FOUND",
  "message": "No customer found with email: test@example.com"
}
Error Code Description
INVALID_API_KEY The provided API key is invalid or missing
INVALID_PARAMETERS Required parameter customer_email is missing or invalid
CUSTOMER_NOT_FOUND No customer exists with the specified email address
INVALID_EMAIL_FORMAT The provided email address is not in a valid format

Example Request

cURL bash
curl -X GET "https://solarproof.com.au/apidata.php?action=getcustomerid&customer_email=john.smith@example.com&api_key=YOUR_API_KEY"
JavaScript (Fetch) javascript
const apiKey = 'YOUR_API_KEY';
const customerEmail = 'john.smith@example.com';
const url = `https://solarproof.com.au/apidata.php?action=getcustomerid&customer_email=${encodeURIComponent(customerEmail)}&api_key=${apiKey}`;

fetch(url)
  .then(response => response.json())
  .then(customer => {
    console.log('Customer ID:', customer.customer_id);
    console.log('Customer Name:', customer.customer_first_name, customer.customer_last_name);
    console.log('Total Projects:', customer.projects.length);
  })
  .catch(error => console.error('Error:', error));
PHP php
<?php
$apiKey = 'YOUR_API_KEY';
$customerEmail = 'john.smith@example.com';
$url = "https://solarproof.com.au/apidata.php?action=getcustomerid&customer_email=" 
     . urlencode($customerEmail) 
     . "&api_key={$apiKey}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$customer = json_decode($response, true);

if (isset($customer['customer_id'])) {
    echo "Found customer ID: " . $customer['customer_id'] . "\n";
    echo "Name: {$customer['customer_first_name']} {$customer['customer_last_name']}\n";
} else {
    echo "Customer not found or error occurred\n";
}
?>
Python python
import requests
from urllib.parse import urlencode

api_key = 'YOUR_API_KEY'
customer_email = 'john.smith@example.com'

params = {
    'action': 'getcustomerid',
    'customer_email': customer_email,
    'api_key': api_key
}

url = f'https://solarproof.com.au/apidata.php?{urlencode(params)}'
response = requests.get(url)
customer = response.json()

if 'customer_id' in customer:
    print(f"Customer ID: {customer['customer_id']}")
    print(f"Name: {customer['customer_first_name']} {customer['customer_last_name']}")
    print(f"Projects: {len(customer['projects'])}")
else:
    print('Customer not found or error occurred')

Common Use Cases

Email-to-ID Mapping

When integrating with external systems that use email as the primary identifier, use this endpoint to map emails to Solar Proof customer IDs for subsequent API calls.

Customer Verification

Verify that a customer exists in your system before performing operations. Particularly useful in form submissions or customer portals.

Quick Customer Lookup

Build search functionality that allows staff to quickly find customer records by email rather than remembering or looking up customer IDs.

Pre-Update ID Retrieval

When you need to update or delete a customer but only have their email, use this endpoint first to get their ID, then perform the update/delete operation.

Workflow Example

Here's a complete workflow showing how to find a customer by email and then update their information:

JavaScript - Find and Update Customer javascript
async function updateCustomerByEmail(email, updates) {
  const apiKey = 'YOUR_API_KEY';
  
  // Step 1: Get customer ID from email
  const findUrl = `https://solarproof.com.au/apidata.php?action=getcustomerid&customer_email=${encodeURIComponent(email)}&api_key=${apiKey}`;
  
  const findResponse = await fetch(findUrl);
  const customer = await findResponse.json();
  
  if (!customer.customer_id) {
    throw new Error('Customer not found');
  }
  
  console.log(`Found customer ID: ${customer.customer_id}`);
  
  // Step 2: Update the customer using their ID
  const updateUrl = `https://solarproof.com.au/apidata.php?api_key=${apiKey}&action=updatecustomer`;
  
  const updateData = {
    data: {
      apikey: apiKey,
      action: 'updatecustomer',
      pkcustomerid: customer.customer_id,
      ...updates
    }
  };
  
  const updateResponse = await fetch(updateUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(updateData)
  });
  
  const result = await updateResponse.json();
  console.log('Update result:', result);
  return result;
}

// Usage
updateCustomerByEmail('john.smith@example.com', {
  phone1: '0400123456',
  customer_status: 'Signed'
});

Related Endpoints