Skip to main content
Track per-tenant credit consumption and API usage to understand how each tenant utilizes your Papermap integration. This feature enables transparent billing, usage analytics, and resource monitoring.

Overview

When using API key authentication with the X-Tenant-ID header, Papermap automatically tracks:
  • Credits consumed per tenant per billing period
  • Request count per tenant per billing period
  • Monthly aggregation with automatic period bucketing
This allows workspace owners to see which tenants are consuming credits and resources.

How It Works

Billing Period

Usage is automatically bucketed by calendar month:
  • Period Start: First day of month (e.g., 2025-01-01 00:00:00)
  • Period End: Last day of month (e.g., 2025-01-31 23:59:59)
Each unique tenant gets a separate usage record per month.

API Endpoints

The base URL for the Papermap API is https://prod.dataapi.papermap.ai/.

Get Workspace Tenant Usage

Retrieve usage data for all tenants in a workspace. Request:
Query Parameters: Example Request:
Response:

Get Tenant Usage History

Retrieve usage history for a specific tenant. Request:
Query Parameters: Example Request:
Response:

Authentication

These endpoints use the same HMAC signature authentication as other external API endpoints. See the Authentication Guide for details. Required headers:
  • X-API-Key-ID: Your API key identifier
  • X-Workspace-ID: Your workspace ID
  • X-Valid-Until: Unix timestamp for request expiration
  • X-Signature: HMAC-SHA256 signature

Implementation Examples

The _get_auth_headers function is a helper function that generates the HMAC signature for the API request found in the HMAC Authentication guide.

Use Cases

Billing & Invoicing

Generate per-tenant invoices based on actual usage
  • Query usage for billing period
  • Calculate costs based on credits consumed
  • Automate invoice generation

Usage Analytics

Monitor tenant consumption patterns
  • Identify high-usage tenants
  • Track usage trends over time
  • Plan capacity accordingly

Quota Management

Implement tenant-level quotas
  • Compare usage against limits
  • Send usage warnings
  • Enforce rate limits per tenant

Cost Allocation

Attribute costs to business units
  • Track departmental usage
  • Chargeback reporting
  • Budget planning

Response Fields

Error Responses

Example Error Response:

Next Steps

Authentication

Learn how to authenticate API requests

API Endpoints

Explore other available API endpoints