Authentication and Identification

Authenticate requests to the Stax Bill API by creating an API key and sending it in the Authorization header.

Manage your API key in Stax Bill's UI. Your API key carries many privileges, so do not share it in publicly accessible places such as GitHub repositories or client-side code.

Create an API key

  1. In the Stax Bill UI, go to Settings -> Integrations -> API Key.
  2. Click Create Key.
  3. Copy the generated key and store it securely.

The generated key is shown in bold in the UI. Copy it into the Authorization header in your application.

Send the API key in requests

Stax Bill uses HTTP Basic Auth. Send your API key as the Basic auth username value. You do not need to send a password.

For example:

Authorization: Basic MDpFSDl2RTBRNTZVYVJYdnZROE8wb2JpMzJsSDJPNXh0YlZneVRDN2o1d0NCbEEwamV6ZmhDMVNwd2t4U0paSW9q
-H "Authorization: Basic YourAPIKeyHere" \

If Stax Bill Support generated your API key, it will continue to work even if the value in your integration code does not exactly match the value shown in the Admin UI. This difference is caused by older and newer key encryption formats. Do not regenerate the key unless you are ready to update your integration at the same time.

Deleting or regenerating a key immediately breaks any existing application code that uses that key. Update your integration before sending requests again, or you will receive authorization errors.

Request requirements

  • Send all API requests over HTTPS. Plain HTTP requests fail.
  • Include authentication on every request. Unauthenticated requests fail.
  • Use TLS 1.2. HTTP compression is encouraged.

Add Content-Type: application/json for PUT, PATCH, and POST requests that send a JSON body.

-H "Content-Type: application/json"

Optional: Add an audit source

Use the x-audit-source header to label where an API call originated. In the audit log, Stax Bill marks API-based changes with the source API unless you override it with a custom value.

For example, if requests come from a registration page, send:

-H "x-audit-source: API - Registration Page" \

This is the audit log as seen through the UI:

1575