5.9 KiB
Return to top
Create Hetzner Server
===========================================================================================================================
POST
/servers/hetzner
Create a new server on Hetzner and register it in Coolify.
Authorizations
bearerAuth
Go to Keys & Tokens / API tokens and create a new token. Use the token as the bearer token.
Type
HTTP (bearer)
Request Body
application/json
SchemaJSON
JSON
{
"cloud_provider_token_uuid": "abc123",
"cloud_provider_token_id": "abc123",
"location": "nbg1",
"server_type": "cx11",
"image": 15512617,
"name": "my-server",
"private_key_uuid": "xyz789",
"enable_ipv4": true,
"enable_ipv6": true,
"hetzner_ssh_key_ids": [
0
],
"cloud_init_script": "string",
"instant_validate": false
}
Responses
201
Hetzner server created.
Content-Type
application/json
SchemaJSON
JSON
{
"uuid": "og888os",
"hetzner_server_id": 0,
"ip": "string"
}
POST
/servers/hetzner
Playground
Authorization
bearerAuth
Body
JSON
{
cloud_provider_token_uuid
:
abc123
cloud_provider_token_id
:
abc123
location
:
nbg1
server_type
:
cx11
image
:
15512617
name
:
my-server
private_key_uuid
:
xyz789
enable_ipv4
:
true
enable_ipv6
:
true
hetzner_ssh_key_ids
:
[
1 item
0
:
0
]
cloud_init_script
:
string
instant_validate
:
false
}
Try it out
Samples
BrunocURLJavaScriptPHPPython
Bruno
POST https://app.coolify.io/api/v1/servers/hetzner
Headers
authorization: Token
content-type: application/json
Body
{
"cloud_provider_token_uuid": "abc123",
"cloud_provider_token_id": "abc123",
"location": "nbg1",
"server_type": "cx11",
"image": 15512617,
"name": "my-server",
"private_key_uuid": "xyz789",
"enable_ipv4": true,
"enable_ipv6": true,
"hetzner_ssh_key_ids": [\
0\
],
"cloud_init_script": "string",
"instant_validate": false
}
cURL
curl https://app.coolify.io/api/v1/servers/hetzner \
--request POST \
--header 'Authorization: Token' \
--header 'Content-Type: application/json' \
--data '{
"cloud_provider_token_uuid": "abc123",
"cloud_provider_token_id": "abc123",
"location": "nbg1",
"server_type": "cx11",
"image": 15512617,
"name": "my-server",
"private_key_uuid": "xyz789",
"enable_ipv4": true,
"enable_ipv6": true,
"hetzner_ssh_key_ids": [\
0\
],
"cloud_init_script": "string",
"instant_validate": false
}'
JavaScript
fetch('https://app.coolify.io/api/v1/servers/hetzner', {
method: 'POST',
headers: {
Authorization: 'Token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
cloud_provider_token_uuid: 'abc123',
cloud_provider_token_id: 'abc123',
location: 'nbg1',
server_type: 'cx11',
image: 15512617,
name: 'my-server',
private_key_uuid: 'xyz789',
enable_ipv4: true,
enable_ipv6: true,
hetzner_ssh_key_ids: [0],
cloud_init_script: 'string',
instant_validate: false
})
})
PHP
$ch = curl_init("https://app.coolify.io/api/v1/servers/hetzner");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([\
'cloud_provider_token_uuid' => 'abc123',\
'cloud_provider_token_id' => 'abc123',\
'location' => 'nbg1',\
'server_type' => 'cx11',\
'image' => 15512617,\
'name' => 'my-server',\
'private_key_uuid' => 'xyz789',\
'enable_ipv4' => true,\
'enable_ipv6' => true,\
'hetzner_ssh_key_ids' => [\
0\
],\
'cloud_init_script' => 'string',\
'instant_validate' => false\
]));
curl_exec($ch);
curl_close($ch);
Python
requests.post(
"https://app.coolify.io/api/v1/servers/hetzner",
headers={
"Authorization": "Token",
"Content-Type": "application/json"
},
json={
"cloud_provider_token_uuid": "abc123",
"cloud_provider_token_id": "abc123",
"location": "nbg1",
"server_type": "cx11",
"image": 15512617,
"name": "my-server",
"private_key_uuid": "xyz789",
"enable_ipv4": true,
"enable_ipv6": true,
"hetzner_ssh_key_ids": [\
0\
],
"cloud_init_script": "string",
"instant_validate": false
}
)
Powered by VitePress OpenAPI