Skip to content

Base316 connector

If your own product uses Base316 for sign-in and billing, the Base316 connector links it to cost and margin per end customer. It does three things on its schedule:

  1. Syncs your customers. Every Base316 customer (and the organization linked to it) is kept with its name, plan and MRR.
  2. Imports revenue. Each customer’s MRR becomes this month’s revenue, so the Customers tab can show margin. MRR follows Base316’s own rule: the plan version’s flat prices over the billing interval in months, for live subscriptions (active or past due).
  3. Pushes AI usage, if you turn it on. Each customer’s AI usage per complete hour is recorded on a Base316 meter, so you can bill your customers for it.

This connector uses your Base316 environment and your secret key. It is separate from the Base316 account Shield360 itself bills you through.

  1. In Base316, create a secret key for the environment your product bills from.
  2. In Shield360, select the project and environment whose apps you tagged, then open Connectors and add Base316 (your customers’ billing).
  3. Paste the secret key, choose how often to sync, and save. The first sync runs within five minutes; the connector’s test button runs one now.

A secret key starts b316_sk_live_ (production) or b316_sk_sandbox_ (sandbox). It is stored encrypted on the connector, or read from a Vault entry you name instead, and is never shown again, logged or put in the audit log. Shield360 only ever sends it to the Base316 API.

A customer’s calls are matched when your apps tag them with any of these (as tenant ids, see Tag calls with a customer):

  • the Base316 customer’s externalId
  • the Base316 customer id
  • the id or externalId of the Base316 organization linked to the customer
  • a tenant id you set for that customer by hand (PUT /api/costs/customers/base316/mapping)

If your organisation hashes tenant ids, the connector hashes these the same way, so matching still works.

The usage push is off until you turn it on, and it starts only after you have previewed it.

  1. In Base316, create a meter. Note its event name and, for a sum meter, its value property.
  2. On the connector, set Meter event name, Value property (default value) and Unit: tokens, model calls, or estimated cost in USD. Turn on Push AI usage to Base316.
  3. On Costs → Customers, under Base316, select Preview usage push. The preview shows the last 24 complete hours per customer, which customers matched, and the meter the events land on. Nothing is sent.
  4. From then on, each sync sends every complete hour (an hour after it ends, so late telemetry is included), one event per customer and hour.

Each event is a POST /v1/events with the matched Base316 customer id, your event name, the quantity at your value property, and an idempotency key made from the connector, environment, customer, hour, unit and event name. Base316 keeps that key permanently, so a retry or a second run never counts an hour twice; it answers duplicate instead. Changing the meter, unit or value property needs a new preview.

Usage for a tenant id that matches no Base316 customer is logged as No Base316 customer and not sent. A failed push is retried on the next run, and later hours wait for it. The push log under Base316 on the Customers tab shows every hour pushed and its outcome.

Adding, changing and removing the connector, switching the usage push on or off, and each preview are recorded in the audit log with the settings that changed. The secret key never appears there; the record says only whether it changed.