# Change VM hostname

`POST /v1/service/@id/vms/@vmid/hostname` · scope `services:write`

Change the virtual machine's hostname.

## HTTP request

| Item | Value |
| --- | --- |
| URL | `https://api.tino.vn/v1/service/@id/vms/@vmid/hostname` |
| Method | `POST` |
| Scope | `services:write` |
| Header | `Authorization: Bearer <token>` |
| Content-Type | `application/json` |
| Tokens that can call it | app tokens (`tinoat_`), personal API tokens (`tinopat_`) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Service ID |
| `vmid` | path | string | yes | Virtual machine ID |
| `server_name` | body | string | yes | Virtual server name |

## Example request

```bash
curl -X POST "https://api.tino.vn/v1/service/100001/vms/600001/hostname" \
  -H "Authorization: Bearer $TINO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "server_name": "<server_name>"
}'
```

`$TINO_TOKEN` is a token with the scope `services:write`. Path parameters in the example are sample values.

SDK ([SDK & examples](/en/docs/sdk)): Python `client.vms.change_hostname(id, vmid, server_name=...)`, Node.js `await client.vms.changeHostname(id, vmid, { server_name: ... });`, PHP `$client->vms->changeHostname($id, $vmid, ['server_name' => ...]);`.

## Example response

```json
{
 "status": 1
}
```

Live sample from a test account with personal data masked; long arrays and strings are trimmed (`… N more item(s)`, `… N more line(s)`).
