Skip to main content

1. Key Types

Your account has two API keys that together make up your credentials:

2. Authentication Mechanism

OriginBills uses standard HTTP Basic Authentication. You construct the header as follows:
  1. Concatenate keys: Combine your Public Key and Secret Key, separated by a colon (:).
  2. Encode to Base64: Encode the concatenated string into Base64 format.
  3. Set the Header: Add the string to your request’s Authorization header, prefixed with Basic .

3. Code Examples

Below are examples of how to configure the Authorization header in various languages.

cURL

Node.js (Fetch API)

Python (requests)

4. Query Parameter Authorization (GET requests only)

For convenience in client environments or simple testing, GET endpoints support sending the Authorization credentials via the authorization query parameter:

5. Security Best Practices

[!WARNING] Keep your credentials secure. Your API keys have full access to view wallet balances and place recharges.
  • Never commit secret keys to public repositories or front-end client bundles.
  • Rotate your API keys regularly from the OriginBills dashboard if you suspect a leak.
  • Use HTTPS always: Plain HTTP requests transmitting credentials will be rejected.

6. Authentication Errors

If your credentials are missing, invalid, or formatted incorrectly, the API returns 401 Unauthorized with one of the following schemas:

Missing Header or Parameter

Invalid Credentials Format

Incorrect Keys