# Jobs

Creating a site, deleting one, reinstalling, restoring or making a backup, changing a DNS record, re-checking health
and Site Cleaner runs take seconds to minutes. Those calls answer at once (usually `202 Accepted`) with a `job`:

```json
{"data": {"id": 88001, "state": "Pending"},
 "job": {"id": "job_4f1c0a9e2b7d6c5a3e10", "kind": "backup.create", "status": "running",
         "url": "https://app.pbn.ltd/api/v1/jobs/job_4f1c0a9e2b7d6c5a3e10"}}
```

Poll `GET /jobs/{job_id}` until `status` is `succeeded` or `failed`; `message` says what happened. The status is read
live from the site or backup itself, so it is always what the panel shows.

| kind | finished when |
|---|---|
| `site.create` | the site is installed (Ok, or waiting for its nameservers) |
| `site.update` | the server change is applied (PHP version, domain, HTTPS/www) |
| `site.reinstall`, `site.restore` | the site is back up |
| `site.delete` | the site is gone |
| `backup.create` | the backup is Ok |
| `dns.publish` | the records were published at the DNS provider |
| `health.recheck` | the home page was probed again |
| `cleaner.scan`, `cleaner.clean`, `cleaner.undo` | Site Cleaner finished |

A job with no result after 12 hours is marked failed.
