# Public URLs

An endpoint is an HTTPS URL for one TCP port of one machine. Your server in the machine speaks plain HTTP on the port. arvm's gateway holds the TLS certificate and forwards each request.

The examples use a machine named `calm-river-otter` and read the API key from `ARVM_API_KEY`.

## Expose a port

First, start something that listens on the port. In the machine:

```console
$ python3 -m http.server 8080
```

Then, from your computer:

```console
$ arvm expose calm-river-otter 8080
```

The URL is private: it answers only a request that carries the signed link the command prints. `arvm expose calm-river-otter 8080 --public` makes it answer anyone. `arvm endpoints calm-river-otter` lists a machine's URLs, and `arvm unexpose calm-river-otter 8080` takes one away.

The same through the API:

```console
$ curl -s -X PUT "https://api.arvm.dev/v1/machines/calm-river-otter/endpoints/8080" \
    -H "Authorization: Bearer $ARVM_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"visibility": "private"}'
```

```json
{
  "machine_id": "m_01jcz3k8x0e5v9w2r4t6y8a0bq",
  "port": 8080,
  "visibility": "private",
  "url": "https://8080-calm-river-otter-x7k2.apps.arvm.dev",
  "signed_url": "https://8080-calm-river-otter-x7k2.apps.arvm.dev/?_acre_token=eyJwIjo4MDgwfQ.c2lnbmF0dXJl",
  "created_at": "2026-11-10T20:45:00Z"
}
```

The URL is `https://<port>-<dns_label>.apps.arvm.dev`. The DNS label is the machine's first name plus a short suffix. It never changes, so the URL stays the same when you rename, stop or start the machine.

## Open a private endpoint

A new endpoint is private. It answers only a request that carries the token in `signed_url`.

1. Open `signed_url` in a browser. The gateway checks the token and sets a cookie.
2. After that, the plain `url` works in that browser.

Without the token or the cookie, the gateway answers 401 and the request never reaches your machine.

```console
$ curl -s -o /dev/null -w "%{http_code}\n" "https://8080-calm-river-otter-x7k2.apps.arvm.dev"
401
```

Anyone who has the signed link can open the endpoint. Treat the link as a password.


## Make an endpoint public

A public endpoint answers anyone on the internet.

```console
$ curl -s -X PUT "https://api.arvm.dev/v1/machines/calm-river-otter/endpoints/8080" \
    -H "Authorization: Bearer $ARVM_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"visibility": "public"}'
```

The same request with `"visibility": "private"` makes it private again. A public endpoint has no `signed_url`.

Before you make an endpoint public, read the [acceptable use policy](../legal/acceptable-use.md). What your machine serves is yours to answer for.

## List endpoints

```console
$ curl -s "https://api.arvm.dev/v1/machines/calm-river-otter/endpoints" \
    -H "Authorization: Bearer $ARVM_API_KEY"
```

## Remove an endpoint

The URL stops answering at once.

```console
$ curl -s -X DELETE "https://api.arvm.dev/v1/machines/calm-river-otter/endpoints/8080" \
    -H "Authorization: Bearer $ARVM_API_KEY"
```

## What an endpoint does and does not do

- An endpoint carries HTTP. For another protocol over TCP, forward the port to your own computer over SSH: [Connect](connect.md#use-an-editor-copy-files-forward-a-port). To open such a port, or a UDP port, to the internet, use the machine's own IPv6 address: [Connect](connect.md#ipv6).
- A request to an endpoint counts as activity, so traffic keeps a machine from being idle-stopped.
- An endpoint of a stopped machine does not answer. A request does not start the machine.
- Custom domains are not available.


[The machines reference](api/machines.md#expose-a-port) lists every field.
