# Quick start

From an API key to a playing video in six requests.

### Create an API key

Open [Account, Developer](https://fastwater.app/account/developer) and press
**Create an API key**. Name it after your script, keep **Full access**, and
press **Create key**. Copy the key: it starts with `ak_`. See
[Authentication](/docs/authentication) for limited keys.

```sh
export FASTWATER_KEY=ak_...
export FASTWATER=https://fastwater.app
```

### Check the cache

Torrents other members already added are cached and complete at once.

```sh
curl "$FASTWATER/v1/cache?hash=08ada5a7a6183aae1e09d831df6748d566095a10" \
  -H "Authorization: Bearer $FASTWATER_KEY"
```

### Add a magnet

```sh
curl -X POST "$FASTWATER/v1/transfers" \
  -H "Authorization: Bearer $FASTWATER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"magnet":"magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel"}'
```

### Poll the transfer

Every few seconds, until `status` is `completed`. The response lists the new
`fileIds`.

```sh
curl "$FASTWATER/v1/transfers/$TRANSFER_ID" -H "Authorization: Bearer $FASTWATER_KEY"
```

### Get a playback URL

It supports HTTP Range and expires at `expiresAt`; when it returns `403`, ask
for a new one. The response also has signed WebVTT subtitle URLs and the saved
position.

```sh
curl -X POST "$FASTWATER/v1/files/$FILE_ID/playback" -H "Authorization: Bearer $FASTWATER_KEY"
```

### Save progress

About every 10 seconds, and on pause. Progress syncs to the dashboard and the
TV apps.

```sh
curl -X PUT "$FASTWATER/v1/files/$FILE_ID/progress" \
  -H "Authorization: Bearer $FASTWATER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"positionSeconds":120,"durationSeconds":888}'
```
