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

Description

Returns a comprehensive list of customers from all users in your company account. The response includes detailed customer information, associated projects with solar system specifications, customer notes, and the owner user details. Results are paginated with 50 customers per page.

Pagination: This endpoint returns a maximum of 50 customers per request. Use the page parameter to retrieve additional pages of results.

Request Parameters

Query Parameters

Parameter Type Required Description
api_key string Required Your Solar Proof API key
action string Required Must be set to "getallcustomers"
page integer Optional Page number for pagination (default: 1). Each page returns 50 customers.
Page 1: customers 1-50, Page 2: customers 51-100, etc.

Response

Success Response (200 OK)

Returns an array of customer objects. Each customer object contains comprehensive information including projects and notes.

Response Body JSON
[
  {
    "customer_id": "71553",
    "gst_status": "Not GST Registered",
    "customer_first_name": "Will",
    "customer_last_name": "Jones",
    "customer_phone_1": "0400 000 888",
    "customer_phone_2": "",
    "customer_email": "mygreatcustomer@willibags.com",
    "customer_type": "Residential",
    "company_name": "",
    "company_phone": "",
    "owner_user_info": {
      "user_id": "221",
      "first_name": "John",
      "last_name": "User",
      "phone_number": "0415 644 644",
      "email": "user@bigsolarcity.com.au",
      "work_title": "Director",
      "username": "user1"
    },
    "creation_date": "2020-05-26",
    "customer_notes": [
      {
        "datetime": "2020-05-28 15:12:40",
        "note": "Will is a friendly guy. Wants a call next monday"
      }
    ],
    "customer_status": "No Status Set",
    "projects": [
      {
        "project_id": "1640",
        "project_title": "Project #1640",
        "site_address": {
          "streetnum": "175",
          "street": "Pitt Street",
          "suburb": "Sydney",
          "state": "NSW",
          "postcode": "2000",
          "country": "Australia"
        },
        "solar_panel_quantity": "7",
        "solar_panel_type": "320W - SUNPOWER - (SPR-E19-320)",
        "inverter_quantity": "1",
        "inverter_type": "Zeversolar 4kW (TLC4000)",
        "system_size": 2.24,
        "proposal_link": "/uploads/fa00dfba91388/pdfs/1640/proposal_1640.pdf"
      }
    ]
  }
]

Response Fields

Field Type Description
customer_id string Unique identifier for the customer
gst_status string "GST Registered" or "Not GST Registered"
customer_first_name string Customer's first name
customer_last_name string Customer's last name
customer_phone_1 string Primary phone number
customer_phone_2 string Secondary phone number (may be empty)
customer_email string Customer's email address
customer_type string "Residential", "Commercial", or "Large-Scale"
company_name string Company name (for commercial customers)
company_phone string Company phone number
owner_user_info object Details about the user who created this customer (see below)
creation_date date Date the customer was created (YYYY-MM-DD)
customer_notes array Array of note objects with datetime and note text
customer_status string Current customer status
projects array Array of project objects associated with this customer (see below)

Owner User Info Object

Field Type Description
user_id string ID of the user who created the customer
first_name string User's first name
last_name string User's last name
phone_number string User's phone number
email string User's email address
work_title string User's job title
username string User's username

Project Object

Field Type Description
project_id string Unique identifier for the project
project_title string Display title of the project
site_address object Address components: streetnum, street, suburb, state, postcode, country
solar_panel_quantity string Number of solar panels in the system
solar_panel_type string Solar panel model and specifications
inverter_quantity string Number of inverters in the system
inverter_type string Inverter model and specifications
system_size number Total system size in kilowatts (kW)
proposal_link string URL path to the project proposal PDF (if published)

Error Response (4xx/5xx)

Error Response JSON
{
  "code": "INVALID_API_KEY",
  "message": "The provided API key is invalid"
}
Error Code Description
INVALID_API_KEY The provided API key is invalid or missing
INVALID_PARAMETERS Required parameters are missing or invalid
NO_CUSTOMERS_FOUND No customers exist for the specified page

Example Request

cURL bash
curl -X GET "https://solarproof.com.au/apidata.php?action=getallcustomers&page=1&api_key=YOUR_API_KEY"
JavaScript (Fetch) javascript
const apiKey = 'YOUR_API_KEY';
const page = 1;
const url = `https://solarproof.com.au/apidata.php?action=getallcustomers&page=${page}&api_key=${apiKey}`;

fetch(url)
  .then(response => response.json())
  .then(customers => {
    console.log(`Retrieved ${customers.length} customers`);
    customers.forEach(customer => {
      console.log(`${customer.customer_first_name} ${customer.customer_last_name} - ${customer.customer_email}`);
    });
  })
  .catch(error => console.error('Error:', error));
PHP php
<?php
$apiKey = 'YOUR_API_KEY';
$page = 1;
$url = "https://solarproof.com.au/apidata.php?action=getallcustomers&page={$page}&api_key={$apiKey}";

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

$customers = json_decode($response, true);

foreach ($customers as $customer) {
    echo "{$customer['customer_first_name']} {$customer['customer_last_name']}\n";
    echo "Projects: " . count($customer['projects']) . "\n";
    echo "---\n";
}
?>
Python python
import requests

api_key = 'YOUR_API_KEY'
page = 1
url = f'https://solarproof.com.au/apidata.php?action=getallcustomers&page={page}&api_key={api_key}'

response = requests.get(url)
customers = response.json()

print(f'Retrieved {len(customers)} customers')

for customer in customers:
    print(f"{customer['customer_first_name']} {customer['customer_last_name']}")
    print(f"  Email: {customer['customer_email']}")
    print(f"  Projects: {len(customer['projects'])}")
    print("---")

Pagination Example

To retrieve all customers, you'll need to make multiple requests using pagination. Here's an example of how to iterate through all pages:

JavaScript - Fetch All Customers javascript
async function getAllCustomers(apiKey) {
  const allCustomers = [];
  let page = 1;
  let hasMore = true;

  while (hasMore) {
    const url = `https://solarproof.com.au/apidata.php?action=getallcustomers&page=${page}&api_key=${apiKey}`;
    
    const response = await fetch(url);
    const customers = await response.json();
    
    if (customers.length > 0) {
      allCustomers.push(...customers);
      console.log(`Fetched page ${page}: ${customers.length} customers`);
      page++;
    } else {
      hasMore = false;
    }
  }

  console.log(`Total customers retrieved: ${allCustomers.length}`);
  return allCustomers;
}

// Usage
getAllCustomers('YOUR_API_KEY')
  .then(customers => console.log('All customers:', customers));

Common Use Cases

CRM Synchronization

Export all customer data to your CRM system. The response includes everything needed for comprehensive customer profiles including contact details, projects, and notes.

Analytics & Reporting

Generate reports on customer types, project counts, system sizes, and more. Perfect for business intelligence and sales analytics.

Data Backup

Create automated backups of your customer database. Retrieve all pages and store in your own backup system for disaster recovery.

Related Endpoints