# PBN.LTD API

The PBN.LTD API lets you run your hosting account from your own dashboards, scripts and AI tools: list and search
sites, create sites of every type, change settings and PHP versions, manage DNS records, take and restore backups,
browse and upload files, read error and access logs, check health, see billing and invoices, and open support
tickets.

Base URL: `https://app.pbn.ltd/api/v1`. Every answer is JSON (except file and PDF downloads), UTF-8, with dates in ISO 8601 UTC.

## Quick start

1. Create a key at [API keys](/api/keys/) (menu: your name > API keys). Copy it - it is shown once.
2. Keep it secret: store it in an environment variable, e.g. `export PBN_API_KEY=pbn_...`.
3. Call the API:

```bash
curl -s https://app.pbn.ltd/api/v1/me -H "Authorization: Bearer $PBN_API_KEY"
```

```python
import os, requests
r = requests.get("https://app.pbn.ltd/api/v1/sites", headers={"Authorization": "Bearer " + os.environ["PBN_API_KEY"]})
for site in r.json()["data"]:
    print(site["domain"], site["state"], site["online"]["status"] if site["online"] else "-")
```

```javascript
const res = await fetch("https://app.pbn.ltd/api/v1/sites?state=frozen", {
  headers: {Authorization: `Bearer ${process.env.PBN_API_KEY}`}
});
const {data} = await res.json();
```

## What you get back

A single object comes as `{"data": {...}}`; a list as `{"data": [...], "next_cursor": "...", "has_more": true}`
(see [Pagination](/api/docs/pagination)). An action that finishes later also returns a `job` (see [Jobs](/api/docs/jobs)).
An error is `{"error": {"code": "...", "message": "...", "details": {...}}}` with a matching HTTP status
(see [Errors](/api/docs/errors)).

## Same rules as the panel

The API does exactly what the panel does, through the same code: the same checks, limits and refusals apply (an
expired plan, a paused or suspended site, a busy site, the site-slot limit, the ticket limits, add-ons that must be
active). The API never gives more access than your account has.

## Machine-readable

- OpenAPI 3.1: [https://app.pbn.ltd/api/v1/openapi.json](https://app.pbn.ltd/api/v1/openapi.json) (import it into Postman, Insomnia or a code generator).
- For AI tools: [llms.txt](/api/docs/llms.txt) (index) and [llms-full.txt](/api/docs/llms-full.txt) (everything);
  every page is also available as Markdown by adding `.md` to its address.
