Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Annaro's avatar

Forge SDK - createServer - The given data failed to pass validation.

Hi all,

I can't seem to be able to create a server with Forge SDK. I can access my existing servers or one in particular, but i can't create a new one. I keep getting the error:

The given data failed to pass validation.

Is it possible to have more information about which parameters are missing or are wrong? I cannot find the information. Of course i am checking the documentation https://forge.laravel.com/api-documentation#servers, but i still cannot make it work. I tried a LOT of combinations...

I tried with exactly all and only the values they are providing:

        $server = $forge->createServer([
            "provider" => "ocean2",
            "ubuntu_version" => "20.04",
            "type" => "web",
            "credential_id" => 1,
            "name" => "test-via-api",
            "size" => "s-1vcpu-1gb",
            "database" => "test123",
            "php_version" => "php71",
            "region" => "ams2",
            "recipe_id" => null
        ]);

but it does not work.

I tried many versions of this ($worker_server_1 being an existing server) (note that the camel case is necessary to retrieve the attributes from the existing server, the snake case does not work, i don't know why):

$server = $forge->createServer([
            "provider" => $worker_server_1->provider,
            "ubuntu_version" => $worker_server_1->ubuntuVersion,
            "type" => $worker_server_1->type,
            "credential_id" => 1,
            "name" => "test-via-api",
            "size" => $worker_server_1->size,
            "php_version" => $worker_server_1->phpVersion,
            "region" => $worker_server_1->region,
            "recipe_id" => null
        ]);

I tried to add the database_type, etc. No success.

How do i move forward with this? How do i get more info about the validation issues? Is there anywhere i could see a functional example?

Thank you!

0 likes
1 reply
Annaro's avatar

Turns out i was (obviously) supposed to use my own credential_id and not just stupidly "1" like in the example. So now i have moved on to the next error :D

Please or to participate in this conversation.