aioghost
Async Python client for the Ghost Admin API.
Installation
pip install aioghost
Quick Start
import asyncio
from aioghost import GhostAdminAPI
async def main():
async with GhostAdminAPI(
api_url="https://your-site.ghost.io",
admin_api_key="your-admin-api-key"
) as api:
# Get site info
site = await api.get_site()
print(f"Site: {site['title']}")
# Get member counts
members = await api.get_members_count()
print(f"Total members: {members['total']}")
print(f"Paid members: {members['paid']}")
# Get MRR
mrr = await api.get_mrr()
print(f"MRR: ${mrr.get('usd', 0) / 100:.2f}")
asyncio.run(main())
Features
- Fully async — Built on
aiohttpfor non-blocking I/O - Type hints — Full type annotations for IDE support
- Context manager — Automatic session cleanup with
async with - Parallel requests — Uses
asyncio.gather()for efficient batching - Proper exceptions — Typed exceptions for different error cases
API Coverage
| Endpoint | Method |
|---|---|
| Site info | get_site() |
| Posts count | get_posts_count() |
| Latest post | get_latest_post() |
| Members count | get_members_count() |
| MRR | get_mrr() |
| Newsletters | get_newsletters() |
| Latest email | get_latest_email() |
| Comments count | get_comments_count() |
| Tiers | get_tiers() |
| ActivityPub stats | get_activitypub_stats() |
| Webhooks | create_webhook(), delete_webhook() |
| Validate credentials | validate_credentials() |
Getting Your Admin API Key
- Log in to your Ghost Admin panel
- Go to Settings → Integrations
- Click Add custom integration
- Copy the Admin API Key (format:
id:secret)
Exceptions
from aioghost import (
GhostError, # Base exception
GhostAuthError, # Invalid API key
GhostConnectionError, # Network error
GhostNotFoundError, # 404 response
GhostValidationError, # Invalid request
)
Passing Your Own Session
If you want to reuse an existing aiohttp.ClientSession:
import aiohttp
from aioghost import GhostAdminAPI
async def main():
async with aiohttp.ClientSession() as session:
api = GhostAdminAPI(
api_url="https://your-site.ghost.io",
admin_api_key="your-key",
session=session,
)
site = await api.get_site()
# Session is NOT closed when api goes out of scope
Copyright & license
Copyright (c) 2013-2026 Ghost Foundation - Released under the MIT license. Ghost and the Ghost Logo are trademarks of Ghost Foundation Ltd. Please see our trademark policy for info on acceptable usage.
Metadata
Release files for aioghost 0.4.31
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aioghost-0.4.31.tar.gz | 114.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aioghost-0.4.31-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 123.1 kB
Release files / aioghost-0.4.31.tar.gz
| Download URL | aioghost-0.4.31.tar.gz |
|---|---|
| Size | 114.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
545141827d3a740c350ba81d80b7242d1861d390facd4dff04186aac2c74d787
|
|
BLAKE2b-256 checksum How to use checksums |
12da74bce9427d5f4a23ec04a78d279255755963185307d46e2185bb08c29be4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / aioghost-0.4.31-py3-none-any.whl
| Download URL | aioghost-0.4.31-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a4bfa6ac900d300a5b50affec8d8ac848bb846a56943fb28ebc0667bebca40f
|
|
BLAKE2b-256 checksum How to use checksums |
be862a0e9ddd17f2900602d54447c53e8dcb513b11843dc8706a4cd370c25533
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency log