Java file requests invalid

Hey there!
I am having quite a bit of trouble sending an API call to POST

Here’s an example of my code:

// Create Temporary file
File tmpFile = Files.write(Path.of(Files.createTempDirectory("uploads_") + File.pathSeparator + fileName), fileData).toFile();
// Put the file in the body...
FileBody fileBody = new FileBody(tmpFile, ContentType.DEFAULT_BINARY);

// Build the multiPartFile
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody("model", model);
builder.addTextBody("language", languageCode);
builder.addPart("file", fileBody);

// Prepare Client
HttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("");

// Prepare Payload

// Set Headers
httpPost.addHeader(HttpHeaders.AUTHORIZATION, "Bearer " + this.apiKey);
httpPost.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");

HttpResponse response = httpclient.execute(httpPost);
HttpEntity entity = response.getEntity();

Here’s the error I am getting ( It’s invalid JSON ):

java.lang.Exception: Invalid HTTP Response from API received: {
    "error": {
        "message": "We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please send an email to and include any relevant code you'd like help with.)",
        "type": "invalid_request_error",
        "param": null,
        "code": null

Hope somebody can help me out, I am more or less stuck on this, and the api is just saying it needs a JSON but also requesting a file? Sorry if this is coming off as noobish :sweat_smile: