Create Customer
Create a new customer record in your Solar Proof account via the API.
https://solarproof.com.au/apidata.php
Description
Creates a new customer in your Solar Proof account. The customer will be associated with the user
specified by the useremail parameter. After successful creation, the API returns the
new customer's ID which can be used for subsequent API calls.
useremail must correspond to an existing user
in your Solar Proof account. If left empty, the customer will be assigned to the API key owner.
Request Parameters
?api_key=YOUR_API_KEY
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key |
string | Required | Your Solar Proof API key |
action |
string | Required | Must be set to "createcustomer" |
Request Body (JSON)
Send a JSON object with a data key containing the following fields. Two request formats
are accepted: a raw JSON body (Content-Type: application/json, as in the examples below),
or a form-encoded POST (application/x-www-form-urlencoded) with a single data
field whose value is the JSON string. Field names are case-sensitive and must match the table exactly;
legacy names such as customerfirstname or customer_name are not read.
| Field | Type | Required | Description |
|---|---|---|---|
apikey |
string | Required | Your Solar Proof API key (can also be in URL) |
action |
string | Required | Must be "createcustomer" |
useremail |
string | Optional | Email of the user who will own this customer (defaults to API key owner) |
firstname |
string | Required | Customer's first name |
surname |
string | Required | Customer's last name |
email |
string | Required | Customer's email address |
phone1 |
string | Required | Primary phone number |
phone2 |
string | Optional | Secondary phone number |
type |
string | Required | Customer type: "residential" or "commercial" (case-insensitive). Anything else defaults to residential. |
companyname |
string | Optional | Company name (for commercial customers) |
companyphone |
string | Optional | Company phone number |
gststatus |
integer | Optional | GST registration status: 1 = registered, 0 = not registered |
Response
Success Response (200 OK)
{
"Message": "Customer created successfully!",
"id": "79459"
}
| Field | Type | Description |
|---|---|---|
Message |
string | Success message |
id |
string | The ID of the newly created customer |
Error Response (4xx/5xx)
{
"code": "INVALID_PARAMETERS",
"message": "Required field 'firstname' is missing"
}
| Error Code | Description |
|---|---|
INVALID_API_KEY |
The provided API key is invalid or missing |
INVALID_PARAMETERS |
Required parameters are missing or invalid |
USER_NOT_FOUND |
The specified useremail does not exist |
DUPLICATE_EMAIL |
A customer with this email already exists |
Example Request
curl -X POST "https://solarproof.com.au/apidata.php?api_key=YOUR_API_KEY&action=createcustomer" \
-H "Content-Type: application/json" \
-d '{
"data": {
"apikey": "YOUR_API_KEY",
"action": "createcustomer",
"useremail": "",
"firstname": "John",
"surname": "Smith",
"phone1": "0412345678",
"phone2": "0298765432",
"email": "john.smith@example.com",
"gststatus": 1,
"companyname": "Smith Solar Solutions",
"companyphone": "1300123456",
"type": "RESIDENTIAL"
}
}'
const apiKey = 'YOUR_API_KEY';
const url = `https://solarproof.com.au/apidata.php?api_key=${apiKey}&action=createcustomer`;
const customerData = {
data: {
apikey: apiKey,
action: 'createcustomer',
useremail: '',
firstname: 'John',
surname: 'Smith',
phone1: '0412345678',
phone2: '0298765432',
email: 'john.smith@example.com',
gststatus: 1,
companyname: 'Smith Solar Solutions',
companyphone: '1300123456',
type: 'RESIDENTIAL'
}
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(customerData)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$apiKey = 'YOUR_API_KEY';
$url = "https://solarproof.com.au/apidata.php?api_key={$apiKey}&action=createcustomer";
$data = [
'data' => [
'apikey' => $apiKey,
'action' => 'createcustomer',
'useremail' => '',
'firstname' => 'John',
'surname' => 'Smith',
'phone1' => '0412345678',
'phone2' => '0298765432',
'email' => 'john.smith@example.com',
'gststatus' => 1,
'companyname' => 'Smith Solar Solutions',
'companyphone' => '1300123456',
'type' => 'RESIDENTIAL'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
?>
import requests
import json
api_key = 'YOUR_API_KEY'
url = f'https://solarproof.com.au/apidata.php?api_key={api_key}&action=createcustomer'
customer_data = {
'data': {
'apikey': api_key,
'action': 'createcustomer',
'useremail': '',
'firstname': 'John',
'surname': 'Smith',
'phone1': '0412345678',
'phone2': '0298765432',
'email': 'john.smith@example.com',
'gststatus': 1,
'companyname': 'Smith Solar Solutions',
'companyphone': '1300123456',
'type': 'RESIDENTIAL'
}
}
response = requests.post(
url,
headers={'Content-Type': 'application/json'},
data=json.dumps(customer_data)
)
print(response.json())