---
title: "Mint Metering Key"
method: POST
path: "/api/v1/provenance/metering/keys"
tags: ["provenance"]
---

# Mint Metering Key

`POST /api/v1/provenance/metering/keys`

## Request

- Base URL: `https://api.badgeia.com`
- URL: `https://api.badgeia.com/api/v1/provenance/metering/keys`
- Auth: none declared

Owner-only: mint a per-agent BYOK virtual key from the LiteLLM proxy.

404s (via ``require_bpp_metering_enabled``) unless BOTH ``BPP_ENABLED``
and ``BPP_METERING_ENABLED`` are true. 404s again if the agent doesn't
exist or isn't owned by the caller (no probe oracle — same detail either
way). 503s if the gateway is unreachable/misconfigured
(``BppMeteringUnavailable`` — an intentional fail-safe, allow-listed in
``app/observability/sentry.py`` so it doesn't page on every attempt
before the founder finishes setup).

## Request body

- MintMeteringKeyRequest
  - `agent_id` string, uuid, required

## Response `200`

Successful Response

- MintMeteringKeyResponse
  - `virtual_key` string, required
  - `virtual_key_last4` string, required
  - `created` boolean, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/badgeia/apis/badge.md) · [All operations](https://skmtc.dev/badgeia/apis/badge/llms.txt) · [OpenAPI document](https://skmtc.dev/badgeia/apis/badge/revisions/7e7f7fee8b77?raw)
