Formatting of Query String for PHP & CURL "Parse Error"

I’m trying to understand how to properly format GraphQL queries for Monday and running into issues.
This is what I have so far

{"query":"mutation { create_item (board_id: 1293347952, item_name: \"project 1\", column_values: {\"status\": \"Active\", \"text\": \"na\", \"date4\": \"2021-05-29\"}) { id }}"}

I get the following response
{"errors":[{"message":"Parse error on \"status\" (STRING) at [1, 86]","locations":[{"line":1,"column":86}]}],"account_id":6734464}

Overall my PHP code is as follows

$response = MondayHelpers::callMondayAPI(

'mutation { create_item (board_id: ' . env('MONDAY_BOARD_ID') . ', item_name: "' . $project->name . '", column_values: {"' . env('MONDAY_STATUS_ID') . '": "Active", "' . env('MONDAY_COMPANY_ID') . '": "' . $request->user()->companydetails->company . '", "' . env('MONDAY_EXPECTED_ID') . '": "' . $project->expecteddate . '"}) { id }}'


public static function callMondayAPI($data) {

        $payload = json_encode(['query' => $data]);


        $curl = curl_init();

        curl_setopt($curl, CURLOPT_POST, 1);

        curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);

        curl_setopt($curl, CURLOPT_URL, "");

        curl_setopt($curl, CURLOPT_HTTPHEADER, [

            "Authorization:" . env("MONDAY_KEY"),



        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

        $result = curl_exec($curl);


        return $result;


Hi @kyler!

In this case, I believe you need to escape your inner quotations, like so:

{"query":"mutation{create_item(board_id: 513638072, item_name: \\"test\\", column_values: \\"{\\\\\\"status15\\\\\\":\\\\\\"Done\\\\\\", \\\\\\"text0\\\\\\":\\\\\\"hi\\\\\\"}\\"){id}}","variables":{}}'

How I like to test the formatting of my queries is to type in GraphQL in Postman, and then use the “Code” button to see the formatting of the code in PHP, or a different language. Give this a go!

Hi @kyler,

Since it’s been a while since we last heard from you, I’m going to mark my last response as the solution.

In case this issue hasn’t been resolved yet, feel free to make an additional comment within a week, or create a new thread.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.