Bitcoin
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Bitcoin
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Every request to the Bitcoin API on TheRPC needs an API key. A self-hosted bitcoind would make you manage rpcuser/rpcpassword HTTP Basic credentials, a cookie file, and an rpcallowip list. TheRPC fronts the Bitcoin Core RPC for you and replaces all of that with a single API key tied to your account — you get a maintained, public-facing endpoint at https://bitcoin.therpc.io/YOUR_API_KEY without running or securing a node yourself. This guide walks through getting a key from your dashboard, the two ways to send it (URL path or Bearer header), securing it, loading it from the environment, and recognizing an authentication failure.
https://bitcoin.therpc.io/YOUR_API_KEY endpoint.There are two ways to present your key, and you only need one of them per request. The simplest is to put the key straight in the URL path: https://bitcoin.therpc.io/YOUR_API_KEY. This is handy for curl one-liners and for thin Bitcoin RPC clients that take a single connection URL. Alternatively, send the key as a Bearer token in the Authorization header (Authorization: Bearer YOUR_API_KEY), which keeps it out of logged URLs and proxy access logs. Whichever you choose, every request must carry the key one of these two ways — an unauthenticated request is rejected.
.env to .gitignore so a key never lands in a public or shared repo..env examples below.When authentication fails, TheRPC returns a JSON-RPC error in the standard envelope: result is null and error carries a code and an "Invalid authentication credentials" message, as shown below. The usual causes are a missing key (no key in the path and no Authorization header), a malformed or mistyped key, an expired or revoked key (regenerate it in the dashboard), or, when the credentials are valid but you've sent too many requests, a rate-limit rejection — see the Rate Limits guide for that case.
Load your key from an environment variable rather than writing it into source. Keep it in a .env file (ignored by git) and read it at startup, building the Bitcoin endpoint URL from the key as shown below. This keeps the secret out of your codebase and lets you swap keys per environment without code changes.