Skip to main content

API

This is a custom API, written in Python using FastAPI, to help me accomplish tasks the can be improved through a RESTful API

Setup

Simplest setup is to start from compose.yml and template.env, which should be renamed to .env

Environment Vairables

  • API_KEY - Any long, random string. Keep this secret as this is the only form of authentication for the API. All routes require it, except /health-check/
  • DATABASE_URL - The URL to connect to postgres DB. Must start with postgresql+psycopg://. Should be in the format specifiec in template.env
  • TZ - Timezone of the container
  • PGTZ - Timezone the Postgres container should use
  • NEXTCLOUD_URL - Base URL (must be https://) of the Nextcloud instance used by the Talk webhooks
  • NEXTCLOUD_TALK_TOKEN - Conversation token of the registered Nextcloud Talk bot used by /webhook/databasus
  • NEXTCLOUD_TALK_SECRET - Shared secret of the registered Nextcloud Talk bot used by /webhook/databasus
  • BESZEL_NEXTCLOUD_TALK_TOKEN - Conversation token for the separate Beszel Talk bot used by /webhook/beszel
  • BESZEL_NEXTCLOUD_TALK_SECRET - Shared secret of the registered Beszel Talk bot

Webhooks

  • POST /webhook/databasus - Forwards a header and message to a Nextcloud Talk conversation via the Nextcloud Talk Bot API, using the nctalk package. Requires the X-API-KEY header and a JSON body: {"header": "...", "message": "..."}
  • POST /webhook/beszel - Forwards Beszel's generic JSON notifications ({"title": "...", "message": "..."}) using a separate Talk bot. Requires the X-API-KEY header. Posts the title in bold followed by the message. Returns {"status": "sent"} on success, 422 for invalid payloads, 500 for missing or insecure Talk configuration, or 502 when delivery fails.

Beszel setup

  1. Register a separate bot named Beszel using Nextcloud's bot management commands and enable it in the destination Talk conversation.

  2. Set NEXTCLOUD_URL, BESZEL_NEXTCLOUD_TALK_TOKEN (the destination conversation token), and BESZEL_NEXTCLOUD_TALK_SECRET (the new bot's shared secret) in .env, then recreate the API container to load the settings. Beszel credentials are required; this endpoint does not fall back to the Databasus bot.

  3. In Beszel, open Settings > Notifications and add this generic webhook URL, replacing the host and API key:

    generic://api.example.com/webhook/beszel?template=json&@X-API-KEY=YOUR_URL_ENCODED_API_KEY
    

    The generic:// service uses HTTPS by default. URL-encode the API key if it contains special characters. template=json supplies the title and message fields, and @X-API-KEY adds the authentication header.

  4. Send a test notification from Beszel, then enable alerts in its systems table.

How to Access

Using the compose.yml file, you can access the API at http://<IP>:5000/health-check. If everything is setup correctly, you should see {"status":"ok"}

Metadata

Release files for js-api 0.3.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for js-api 0.3.20
File Size Uploaded Provenance Actions
js_api-0.3.20.tar.gz 29.2 kB With provenance Details for js_api-0.3.20.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for js-api 0.3.20
File Interpreter ABI Platform Actions
js_api-0.3.20-py3-none-any.whl Python 3 none any Details for js_api-0.3.20-py3-none-any.whl

Total release size: 56.5 kB

Release files / js_api-0.3.20.tar.gz

Download URL js_api-0.3.20.tar.gz
Size 29.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c3a2d0448f0ac14836fbb3f09fb46905a938618e33159a155b6831d05adc0efb
BLAKE2b-256 checksum
How to use checksums
b6e854130628c4f00c7ff864b763f55490d7306045f8b0165b010e26c91d62cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 22, 2026.

Transparency log

Release files / js_api-0.3.20-py3-none-any.whl

Download URL js_api-0.3.20-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26728ac15073d1e094bdcc7fe3ef5dd9028f217e3f4043c94af403102b20001d
BLAKE2b-256 checksum
How to use checksums
2f928edb4e5ef220675456dd253dd6f8b1aeac0bb296ee657dd20c35a956a76a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 22, 2026.

Transparency log

Security for js-api 0.3.20

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for js_api-0.3.20.tar.gz

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 Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.20 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page