Core Concept

Authentication

The Trubills API uses API keys to authenticate requests. You can view and manage your API keys in the Trubills Dashboard.

key

Obtaining your API Key

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Test vs Live Keys

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. We provide two sets of keys:

  • experiment
    Test mode secret key Prefix: tr_test_
  • bolt
    Live mode secret key Prefix: tr_live_
api

Making Authenticated Requests

Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value. You do not need to provide a password.

info If you need to authenticate via Bearer Auth (e.g., for a cross-origin request), use -H "Authorization: Bearer sk_test_..." instead.
Example Request
BASH
curl https://api.trubills.com/v1/customers \
  -u tr_test_51MzABCDEFG12345:
Response
JSON
{
  "object": "list",
  "url": "/v1/customers",
  "has_more": false,
  "data": [
    {
      "id": "cus_N1Mxyz",
      "object": "customer",
      "email": "jenny.rosen@example.com",
      "name": "Jenny Rosen"
    }
  ]
}

warning Authentication Error

If you perform a request with an invalid or missing API key, Trubills will return a 401 Unauthorized response.