Nearglass

Set your monthly spending cap or webhook

`spend_cap_usd` up to the tenant's `limits.max_spend_cap_usd`. At the cap, new viewers are refused (402 `spend_cap_reached`) and viewers already in keep watching; alerts go out at 50, 80 and 100 %. A new cap re-arms the alerts. Setting `webhook_url` answers a new `webhook_secret` once; `null` removes the webhook. Name and limits are the operator's (403).

PATCH
/v1/tenant

spend_cap_usd up to the tenant's limits.max_spend_cap_usd. At the cap, new viewers are refused (402 spend_cap_reached) and viewers already in keep watching; alerts go out at 50, 80 and 100 %. A new cap re-arms the alerts. Setting webhook_url answers a new webhook_secret once; null removes the webhook. Name and limits are the operator's (403).

Authorization

secretKey
headerAuthorizationBearer <token>

sk_...

Request Body

application/json
  1. body
spend_cap_usd?number
Range0 <= value
webhook_url?|

http or https, at a public address (not loopback, private, link-local or an internal name)

Response Body

the tenant

application/json
  1. response
id?string
name?string
scope?|

the relay URL path (/tn_...); null for the default tenant

relays?array<string>
issuer?string
audience?string
public_key_pem?string
secret_keys?array<>
publishable_keys?array<string>
limits?

set by the operator; every field has a value

spend_cap_usd?number|null
webhook_url?string|null
streams?integer
month?
secret_key?string

on create only

webhook_secret?string

when a webhook is set, once

Example Request
curl -X PATCH 'https://api.nearglass.com/v1/tenant' \  -H 'Content-Type: application/json' \  -d '{  "spend_cap_usd": 80}'
Example Response
{  "id": "string",  "name": "string",  "scope": "string",  "relays": [    "string"  ],  "issuer": "string",  "audience": "string",  "public_key_pem": "string",  "secret_keys": [    {      "hint": "string",      "created_at": "string"    }  ],  "publishable_keys": [    "string"  ],  "limits": {    "viewer_cap": 0,    "max_streams": 0,    "max_sessions": 0,    "max_publishers": 0,    "max_egress_mbps": 0,    "max_spend_cap_usd": 0  },  "spend_cap_usd": 0,  "webhook_url": "string",  "streams": 0,  "month": {    "month": "string",    "viewer_hours": 0,    "gib": 0,    "bytes": 0,    "free_viewer_hours": 0,    "free_gib": 0,    "prices": {      "per_gib_usd": 0,      "per_viewer_hour_usd": 0    },    "spend_usd": 0,    "spend_cap_usd": 0,    "percent_of_cap": 0,    "cap_reached": true,    "alerts": [      {        "percent": 50,        "at": "2019-08-24T14:15:22Z"      }    ]  },  "secret_key": "string",  "webhook_secret": "string"}