< All Topics

Sending data directly to the Light Blue API via HTTP POST

HEALTH WARNING: This method is designed to be used only by customers who are confident with web scripting languages such as PHP, because you need to write some simple code that will gather information from an HTML form that you’ve created and send it to our API. If you’re not confident that you can do this yourself, you can send your website developer to this page to read this guide.

Information is sent to the Light Blue API using an HTTP POST request to https://online.lightbluesoftware.com/api.php

The POST request must contain the following key-value pairs:

  • Your Light Blue API key (key: “key”, value: <Your API key>). You can find your API key by going to the My Account page; it will be listed towards the bottom. Your API key should be kept private: if for any reason you suspect that it has been compromised, you can set a new API key via your account page.
  • API request type (key: “type”, value: <The type>). At present the only type that is supported is “contact form” (without the quotes).
  • Parameters, as key-value pairs. A full list of the parameters supported by the Light Blue API can be found here.

Text encoding

The Light Blue API expects data to be sent as UTF-8. Data sent using other text encodings is likely to cause problems or require manual tidying when its imported into Light Blue.

HTTP POST result

The Light Blue API will return a status code and, if an error occurred, a summary of that error. The list of status codes will be expanded as the API evolves.

  • 0: Success.
  • -20: You must use HTTPS when using the Light Blue API. Unsecure HTTP connections will be refused.
  • -3: You’ve supplied an invalid API request type, or didn’t supply any parameters that are valid for this API request type.
  • -4: This is a duplicate API request. The Light Blue API only checks for duplicates if an ID or Reference parameter is supplied, and it requires a unique combination of the ID/Reference and Source parameters.
  • -5: Failed to authenticate. Check that you’ve supplied the correct Light Blue API key for your account.
  • -8: Your subscription to our online services has expired.
  • -9: Your account has not been activated: you have not logged into your trial account at least once from a computer.
  • 500: An error occurred at our end. Please check that you’ve followed this guide and, if you can’t work out what’s causing the problem, get in touch with us so that we can help you.


The following PHP sample code uses curl to send a contact name, shoot date, enquiry source and shoot notes to the Light Blue API. Using cURL requires PHP 4.0.2 or later, and PHP needs to have been compiled with the libcurl package. In our experience, most web hosts that offer PHP support include curl.

	// Build a key-value pair array to be sent to the Light Blue API
	$data = array(
		// You must supply the API key displayed on your account page
		"Key" => "<YOUR API KEY>",
		 // You must supply an API request type
		"Type" => "contact form",
		 // If you want to use US-style dates, specify mm/dd/yyyy
		"DateFormat" => "dd/mm/yyyy",
		 // Data from your form
		"ContactNameFull" => "Andrew Sample",
		"ShootDate" => "01/01/2014",
		"ShootEnquirySource" => "Advert in What Picture magazine",
		"Message" => "We're looking for a photographer."
	// Set up curl
	$curl_connection =
	curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
	curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, True);
	curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, True);
	curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
	// Use curl to send the array to the Light Blue API
	curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $data);
	$result = curl_exec($curl_connection);
Was this article helpful?
Please Share Your Feedback
How Can We Improve This Article?
Table of Contents
Main Menu