After investing another 30 minutes trying to figure out what could be going wrong, I noticed that I can reproduce your error using explicitly your most recent query.
The reason are various typos in it, that I noticed now: you neighter close the “ opened for the mutation, nor the { opened before the query.
Actually, your query should therefore look something like this:
<?php
$pipe_id = 303046137;
$phase_id = 318796213;
$debug = fopen('debug.txt', 'a+');
require_once('vendor/autoload.php');
$headers = [
'accept' => 'application/json',
'authorization' => 'Bearer eyWhateverYoursIs',
'content-type' => 'application/json'
];
$client = new \GuzzleHttp\Client();
try {
$body = '{"query": "mutation {
createCard(input: {
pipe_id: ' . $pipe_id . ',
phase_id: ' . $phase_id . '
}) {
clientMutationId
card { id }
}
}"}';
$body = trim(str_replace("\n", "\\n", $body));
var_dump($body);
$response = $client->request('POST', 'https://api.pipefy.com/graphql', [
'body' => $body,
'headers' => $headers,
'debug' => $debug,
]);
var_dump($response);
} catch (GuzzleHttp\Exception\ClientException $e) {
$response = $e->getResponse();
$responseBodyAsString = $response->getBody()->getContents();
var_dump($responseBodyAsString);
var_dump($e);
}