Trouble sending JSON to LIFX api from ESP8266

Hi all,
I’m building a project in the arduino IDE that uses an ESP8266 SparkFun Thing to stream data being uploaded to Firebase and then passes the values to the LIFX API in order to change the colour of my LIFX Z lightstrip. The streaming works, all that I need it to do now is send a JSON object to the LIFX API.
the problem is that all I am getting returned is:

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

So a 400 error means that the request is incorrectly formatted, but I have no idea where I am going wrong with the formatting.
Can anyone shed some light on my mistake?

Code below:

// Libraries
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <FirebaseArduino.h>

// Constants
#define WIFI_SSID "<*****>"
#define WIFI_PASSWORD "<*****>"

#define LIFXHOST "api.lifx.com"
#define LIFXPATH "v1/lights/all/state"
#define API_KEY "<APIKEY>"

char bodyBuffer[200];
char pathBuffer[200];

const char* host = LIFXHOST;
const int httpsPort = 443;
WiFiClientSecure client;

int LED = 0;

void setup() {
  Serial.begin(9600);
  pinMode(LED, OUTPUT);

  // connect to wifi.
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("connecting");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println();
  Serial.print("connected: ");
  Serial.println(WiFi.localIP());

  Firebase.begin("<firebase_url>");
  Firebase.stream("device_003");
}

void loop() {
  if (Firebase.failed()) {
    Serial.println("streaming error");
    Serial.println(Firebase.error());
  }

  if (Firebase.available()) {
    FirebaseObject event = Firebase.readEvent();
    String eventType = event.getString("type");
    eventType.toLowerCase();

    Serial.print("event: ");
    Serial.println(eventType);
    if (eventType == "put") {
      Serial.print("data: ");
      Serial.println(event.getString("pressure"));
      String path = event.getString("device_002");
      String data = event.getString("pressure");
      Serial.println(data);

      digitalWrite(LED, HIGH);
      sendToLIFX(); 
      delay(1500);
      digitalWrite(LED, LOW);
      Serial.println("out ---------------<<<");
    }
  }
}

//JSON Construction
void sendToLIFX() {
  // JSON object
  StaticJsonBuffer<200> jsonBuffer;
  JsonObject& root = jsonBuffer.createObject();
  root["power"] = "on";
  root["color"] = "red";
  //  root["brightness"] = 1;
  //  root["duration"] = 1;
  //  root["infrared"] = 0;
  size_t JSON_LENGTH = root.measureLength();
  size_t size = JSON_LENGTH + 1;
  char json[size];

  Serial.print(root.printTo(json, size));
  Serial.print("JSON length: ");
  Serial.println(JSON_LENGTH);

  // Connecting to LIFX API
  Serial.print("connecting to ");
  Serial.println(host);
  if (!client.connect(host, httpsPort)) {
    Serial.println("connection failed");
    return;
  }

  String url = LIFXPATH;
  Serial.print("requesting URL: ");
  Serial.println(url);

  // Headers
  client.print(String("PUT ") + url + " HTTP/1.1");
  client.println();
  client.print(String("Host: ") + host);
  client.println();
  client.print("Content-Type: application/json");
  client.println();
  client.print("Authorization: Bearer <APIKEY>");
  client.println();
  client.print("Content-Length: " + size);
  client.println();
  client.println(); // 2 line returns

  // Data
  String out;
  root.printTo(out);
  client.print(out);
  client.println();

  Serial.print(String("PUT ") + url + " HTTP/1.1");
  Serial.println();
  Serial.print(String("Host: ") + host);
  Serial.println();
  Serial.print("Content-Type: application/json");
  Serial.println();
  Serial.print("Authorization: Bearer <APIKEY>");
  Serial.println();
  Serial.print("Content-Length: " + JSON_LENGTH);
  Serial.println();
  Serial.println("---");
  Serial.println(out);
  Serial.println("---");

  Serial.println("request sent");
  while (client.connected()) {
    String line = client.readStringUntil('\n');
    if (line == "\r") {
      Serial.println("headers received");
      break;
    }
  }

  //  String line = client.readStringUntil('.');
  String line = client.readString();
  if (line.startsWith("{\"results\"")) {
    Serial.println("esp8266/Arduino CI successfull!");
  } else {
    Serial.println("esp8266/Arduino CI has failed");
  }
  Serial.println();
  Serial.println("reply was:");
  Serial.println("==========");
  Serial.println(line);
  Serial.println("==========");
  Serial.println("closing connection");
}

Thanks,
poodle.

X-posted here on the Arduino forum.