---
icon: material/license
title: "License API"
description: "License Receiver REST API for usage tracking and reporting"
---

The License Receiver API provides endpoints for receiving engine metrics and generating usage reports for air-gapped deployments.

## Write Metrics

`POST /api/v1/write`

Accepts Prometheus Remote Write requests from 10x Engines.

**Request:**

- Content-Type: `application/x-protobuf`
- Content-Encoding: `snappy`
- Body: Prometheus WriteRequest protobuf

**Response:** `200 OK`

This is the same endpoint engines use for `prometheus.log10x.com` - no engine changes required.

---

## Health Check

`GET /health`

Health check endpoint for load balancers and monitoring.

??? tenx-api "Response"
    ```json
    {
      "status": "ok"
    }
    ```

---

## Get Status

`GET /api/v1/status`

Get current node count and tier status.

**Query Parameters:**

| Parameter | Required | Description |
|-----------|----------|-------------|
| `customer_id` | Yes | Customer identifier |
| `env_id` | No | Environment ID (default: "default") |

??? tenx-api "Response"
    ```json
    {
      "customer_id": "acme-corp",
      "env_id": "production",
      "current_nodes": 127,
      "tier": "Growth",
      "tier_max_nodes": 300
    }
    ```

**Example:**

```bash
curl "http://license-receiver:8080/api/v1/status?customer_id=acme-corp&env_id=production"
```

---

## Generate Report

`GET /api/v1/report`

Generate a usage report for billing reconciliation.

**Query Parameters:**

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `customer_id` | Yes | - | Customer identifier |
| `env_id` | No | `default` | Environment ID |
| `period` | No | `30` | Number of days (max 90) |
| `include_daily` | No | `false` | Include daily breakdown |

??? tenx-api "Response"
    ```json
    {
      "version": "1.0",
      "generated_at": "2026-01-10T12:00:00Z",
      "customer_id": "acme-corp",
      "env_id": "production",
      "period": {
        "start": "2025-12-11T00:00:00Z",
        "end": "2026-01-10T00:00:00Z",
        "days": 30
      },
      "usage": {
        "p90_nodes": 127,
        "max_nodes": 156,
        "avg_nodes": 98.5
      },
      "tier": {
        "name": "Growth",
        "max_nodes": 300,
        "status": "within_limit"
      },
      "signature": "a1b2c3d4e5f6..."
    }
    ```

??? tenx-api "Response with Daily Breakdown"
    ```json
    {
      "version": "1.0",
      "generated_at": "2026-01-10T12:00:00Z",
      "customer_id": "acme-corp",
      "env_id": "production",
      "period": {
        "start": "2025-12-11T00:00:00Z",
        "end": "2026-01-10T00:00:00Z",
        "days": 30
      },
      "usage": {
        "p90_nodes": 127,
        "max_nodes": 156,
        "avg_nodes": 98.5
      },
      "tier": {
        "name": "Growth",
        "max_nodes": 300,
        "status": "within_limit"
      },
      "daily_counts": [
        {"date": "2025-12-11", "node_count": 95},
        {"date": "2025-12-12", "node_count": 102},
        {"date": "2025-12-13", "node_count": 98}
      ],
      "signature": "a1b2c3d4e5f6..."
    }
    ```

**Examples:**

```bash
# 30-day report (default)
curl "http://license-receiver:8080/api/v1/report?customer_id=acme-corp"

# 90-day report with daily breakdown
curl "http://license-receiver:8080/api/v1/report?customer_id=acme-corp&period=90&include_daily=true"

# Save to file
curl -o usage-report-q1-2026.json \
  "http://license-receiver:8080/api/v1/report?customer_id=acme-corp&period=90"
```

---

## Report Verification

Reports include an HMAC-SHA256 signature for tamper-evidence. The signature covers:

- Version and generation timestamp
- Customer and environment ID
- Period start/end
- P90 and max node counts

The `REPORT_SIGN_KEY` environment variable configures the signing key.
