Skip to main content

CertApi

Certapi talks with DNS provider and ACME to issue SSL certificates and save it to a keystore.

CertApi is a base library for building other tools, or to integrate Certificate creation feature in your app. CertAPI also provides HTTP api server and can be deployed using Docker

Build Status codecov PyPI version

Why another library?

I designed this library so that it can be imported and plugged in to other python projects. Goal is not to provide CLIs or quick working demo, but to be versatile for any use case.

  • Pluggable keystores for keys and certificates
  • Pluggable Challenge solvers for DNS and Http challenge solving
  • High-level manager with renewal checks and multi-solver support
  • Same interface for working locally, or requesting certificate from certapi server.

See the developer guide in Developer.md for library usage and workflows.

HTTP domain verification

CertAPI 1.1.17 adds GET /api/verify?hostname=example.com&hostname=www.example.com and CertManagerClient.verify_domains(hosts). The server writes a temporary HTTP-01 probe into its filesystem challenge store, fetches each domain's http://<domain>/.well-known/acme-challenge/<token> URL without following redirects, and compares the exact payload. The response contains verified and failed hostname lists. No certificate is obtained or reused; DNS solver support is not treated as HTTP reachability. Invalid hostnames and wildcards fail this HTTP check. A server without a filesystem HTTP solver returns 503.

Reverse proxies must forward the challenge path to this server, including when application routes require authentication, redirect to HTTPS, or return 503. Upgrade the server as well as the client to use this endpoint. A client talking to an older server reports an explicit upgrade error instead of treating API connectivity as domain verification.

Certificate obtain calls with skip_failing=false reject any domains that fail solver selection before issuing the remaining domains. With skip_failing=true, rejected domains appear in the response's failed list, so callers can report partial failures and apply renewal backoff.

Installation

You can install CertApi using pip

pip install certapi

CLI

CertApi also ships with a CLI for quick verification and certificate issuance.

## Certapi's dependencies are already included in the python installation. This doesn't affect the system.
sudo python3 -m pip install certapi --break-system-packages

1. With HTTP Challenge

HTTP challenge requires you to have seup the DNS correctly. The ACME server will verify your domain by making an HTTP request.

# Verify environment and HTTP routing
sudo certapi verify example.com www.example.com

# Obtain a certificate (requires root for HTTP-01)
sudo certapi obtain example.com www.example.com

2. With DNS Provider Key

Using DNS-01 challenge with Cloudflare doesn't require the DNS to be setup. Set your Cloudflare API key as an environment variable.

# Set Cloudflare API key or token
export CLOUDFLARE_API_KEY=...   # or CLOUDFLARE_API_TOKEN

# Verify DNS configuration
sudo certapi verify example.com

# Obtain a certificate using DNS-01
sudo certapi obtain example.com www.example.com

Metadata

Release files for certapi 1.1.17

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

Source distribution (sdist)

Source distribution for certapi 1.1.17
File Size Uploaded Provenance Actions
certapi-1.1.17.tar.gz 79.8 kB Without provenance Details for certapi-1.1.17.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for certapi 1.1.17
File Interpreter ABI Platform Actions
certapi-1.1.17-py3-none-any.whl Python 3 none any Details for certapi-1.1.17-py3-none-any.whl

Total release size: 148.1 kB

Release files / certapi-1.1.17.tar.gz

Download URL certapi-1.1.17.tar.gz
Size 79.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e31854f15f973bcc57dc933f433bea6ad9d83e04d482620f4d985aa793e51611
BLAKE2b-256 checksum
How to use checksums
e7a442fabfe84b75f4f3bcfdf2cbd774b5d0107d397497328484fa9f068c31b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / certapi-1.1.17-py3-none-any.whl

Download URL certapi-1.1.17-py3-none-any.whl
Size 68.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ed31b0fb2838624b23bdaf3f6ba6deaa201592a6d3eae06079c7ee24a80db63
BLAKE2b-256 checksum
How to use checksums
b5e7902a6e86b186ec75ea568cdc390aa96b41e44834b1af2c5a34340ac07af7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for certapi 1.1.17

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

1.1.17 This release

2 release files No 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