{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pomerado-ai/json-schema/pomerado-ai-usage-report-schema.json",
  "title": "UsageReport",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pomerado-ai-openapi.json#/components/schemas/UsageReport",
  "type": "object",
  "required": [
    "from",
    "to",
    "as_of",
    "calls",
    "last_used_at",
    "unattributed_calls",
    "integrations_created",
    "coverage"
  ],
  "properties": {
    "from": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "to": {
      "type": "string"
    },
    "as_of": {
      "type": "string"
    },
    "calls": {
      "type": "integer",
      "description": "Charged tool calls in the range",
      "minimum": 0
    },
    "last_used_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "unattributed_calls": {
      "type": "integer",
      "description": "Calls in the range recorded before calls named their integration",
      "minimum": 0
    },
    "integrations_created": {
      "type": "integer",
      "description": "Successful builds in the range: each build that published a tool, including one that added a tool to an existing integration",
      "minimum": 0
    },
    "coverage": {
      "type": "object",
      "required": [
        "started_at",
        "complete",
        "attribution_complete"
      ],
      "properties": {
        "started_at": {
          "type": "string",
          "description": "When usage recording began"
        },
        "complete": {
          "type": "boolean",
          "description": "The whole range lies within recorded history"
        },
        "attribution_complete": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "groups": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "integration_id",
          "name",
          "calls",
          "last_used_at",
          "integrations_created"
        ],
        "properties": {
          "integration_id": {
            "$ref": "#/$defs/integration_id"
          },
          "name": {
            "type": "string",
            "description": "The integration's name, such as its site's"
          },
          "calls": {
            "type": "integer",
            "description": "a non-negative number",
            "minimum": 0
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "integrations_created": {
            "type": "integer",
            "description": "Successful builds in the range that published a tool still in this integration",
            "minimum": 0
          }
        },
        "additionalProperties": false
      }
    },
    "series": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "start",
          "calls",
          "integrations_created"
        ],
        "properties": {
          "start": {
            "type": "string",
            "description": "The bucket's start, a UTC hour, day or month"
          },
          "calls": {
            "type": "integer",
            "description": "Charged tool calls in the bucket",
            "minimum": 0
          },
          "integrations_created": {
            "type": "integer",
            "description": "Successful builds in the bucket",
            "minimum": 0
          },
          "refused_runs": {
            "type": "integer",
            "description": "Business teams only. New runs refused in the bucket because the team had reached its daily tool call limit: its own daily cap, or Pomerado's limit when lower. Each request counts once, a retry with the same idempotency key included; builds are never refused at it. Absent for a Personal account",
            "minimum": 0
          },
          "first_refused_at": {
            "anyOf": [
              {
                "type": "string",
                "description": "an ISO 8601 UTC time, such as 2026-10-01T00:00:00Z",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?Z$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Business teams only. When the first of the bucket's refused runs was refused; null when none was. Absent for a Personal account"
          }
        },
        "additionalProperties": false
      },
      "description": "Every bucket of the range in order, empty ones included. The first and last bucket count only their part inside the range"
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "tool_id",
          "name",
          "integration_id",
          "integration_name",
          "calls",
          "last_used_at"
        ],
        "properties": {
          "tool_id": {
            "$ref": "#/$defs/tool_id"
          },
          "name": {
            "type": "string",
            "description": "The tool's name"
          },
          "integration_id": {
            "anyOf": [
              {
                "$ref": "#/$defs/integration_id"
              },
              {
                "type": "null"
              }
            ],
            "description": "The integration the calls ran in; null for calls recorded before calls named their integration"
          },
          "integration_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The integration's name, such as its site's"
          },
          "calls": {
            "type": "integer",
            "description": "The tool's charged calls in the range",
            "minimum": 0
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "description": "One row per tool and the integration its calls ran in"
    },
    "credentials": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "kind",
          "id",
          "name",
          "prefix",
          "calls",
          "last_used_at"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "api_key",
              "oauth_app",
              "session",
              "unknown"
            ],
            "description": "api_key: an API key. oauth_app: a connected OAuth app, such as an MCP client. session: signed in to Pomerado, as on the Dashboard, with no API key. unknown: a call recorded without its credential"
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The API key's ID, or the app's OAuth client ID; null for a session, an unknown credential, and an API key since deleted"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The API key's name, or the name the app registered (null when it can't be read now); null for a session or an unknown credential, and for an API key without team:manage (billing:manage on a Personal account)"
          },
          "prefix": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "An API key's visible start, pom_ and 8 hex digits, never its secret; null for any other credential"
          },
          "created_by": {
            "anyOf": [
              {
                "type": "object",
                "required": [
                  "member_id",
                  "name",
                  "email"
                ],
                "properties": {
                  "member_id": {
                    "type": "string",
                    "description": "Their user ID"
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Null when they gave none or their identity is gone, and for an API key without team:manage (billing:manage on a Personal account)"
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Null when their identity is gone, and for an API key without team:manage (billing:manage on a Personal account)"
                  },
                  "unread": {
                    "type": "boolean",
                    "enum": [
                      true
                    ],
                    "description": "Who they are couldn't be read just now: name and email are null without saying they are gone. Absent when it was read"
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "The member who made an API key, whose key it is; null for a service account's key and any other credential"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When an API key was revoked; null while it can be used, and for any other credential"
          },
          "calls": {
            "type": "integer",
            "description": "Charged tool calls through it in the range",
            "minimum": 0
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      }
    },
    "members": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "member_id",
          "name",
          "email",
          "role",
          "calls",
          "integrations_created",
          "last_used_at"
        ],
        "properties": {
          "member_id": {
            "type": "string",
            "description": "The member's user ID"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when they gave none or their identity is gone, and for an API key without team:manage (billing:manage on a Personal account), or a connected app without it unless they are its own member"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when their identity is gone, and for an API key without team:manage (billing:manage on a Personal account), or a connected app without it unless they are its own member"
          },
          "role": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "owner",
                  "admin",
                  "member",
                  "tool_user"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "The member's current role; null once they have left the team, and for an API key without team:manage (billing:manage on a Personal account), or a connected app without it unless they are its own member"
          },
          "calls": {
            "type": "integer",
            "description": "Their charged tool calls in the range",
            "minimum": 0
          },
          "integrations_created": {
            "type": "integer",
            "description": "Their successful builds in the range, including builds that added a tool to an existing integration",
            "minimum": 0
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Their last charged call in the range"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "integration_id": {
      "type": "string",
      "description": "an integration ID: int_ and 32 lowercase hex digits"
    },
    "tool_id": {
      "type": "string",
      "description": "a tool ID: tool_ and 32 lowercase hex digits"
    }
  }
}