332 lines
5.9 KiB
Markdown
332 lines
5.9 KiB
Markdown
[Skip to content](https://coolify.io/docs/api-reference/api/operations/create-hetzner-server#VPContent)
|
||
|
||
Return to top
|
||
|
||
Create Hetzner Server[](https://coolify.io/docs/api-reference/api/operations/create-hetzner-server#create-hetzner-server)
|
||
|
||
===========================================================================================================================
|
||
|
||
POST
|
||
|
||
/servers/hetzner
|
||
|
||
Create a new server on Hetzner and register it in Coolify.
|
||
|
||
Authorizations[](https://coolify.io/docs/api-reference/api/operations/create-hetzner-server#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[](https://coolify.io/docs/api-reference/api/operations/create-hetzner-server#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[](https://coolify.io/docs/api-reference/api/operations/create-hetzner-server#responses)
|
||
|
||
---------------------------------------------------------------------------------------------------
|
||
|
||
201
|
||
|
||
Hetzner server created.
|
||
|
||
Content-Type
|
||
|
||
application/json
|
||
|
||
SchemaJSON
|
||
|
||
JSON
|
||
|
||
{
|
||
|
||
"uuid": "og888os",
|
||
|
||
"hetzner\_server\_id": 0,
|
||
|
||
"ip": "string"
|
||
|
||
}
|
||
|
||
POST
|
||
|
||
/servers/hetzner
|
||
|
||
Playground[](https://coolify.io/docs/api-reference/api/operations/create-hetzner-server#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[](https://coolify.io/docs/api-reference/api/operations/create-hetzner-server#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](https://github.com/enzonotario/vitepress-openapi)
|