API

API Keys

Manage and utilize API keys for secure access to PineBill's RESTful API.

Quick Start

API keys provide secure authentication for programmatic access to PineBill. Manage your API keys at Dashboard → API Keys.

Plan Requirements: API keys are available on Pro and Enterprise plans. Trial accounts get 2 keys for testing with 50 API calls/month.


Creating API Keys

1. Access API Keys Dashboard

Invoice Generator Overview
  1. Navigate to API Keys
  2. Click Create API Key button
  3. API key creation dialog opens

Admin Only: Only organization admins can create API keys. Members and guests can view existing keys.

2. Name Your Key

  • Enter a descriptive name (e.g., "Production Server", "Dev Environment")
  • Use names that identify the key's purpose or location
  • Maximum 100 characters

Good names:

  • "Production API - Backend Server"
  • "Staging Environment"
  • "Mobile App Integration"

Avoid:

  • "Key 1", "Test", "API Key"

3. Save and Copy Your Key

  1. Click Create API Key
  2. Your API key is displayed once only
  3. Copy and store it securely immediately
  4. Click Done when saved
Invoice Generator Overview

Critical: The API key is shown only once. If you lose it, you must revoke and create a new key.


API Key Format

PineBill API keys follow this format:

pb_1234567890abcdefghijklmnopqrstuv

Structure:

  • pb_ - PineBill key prefix
  • [32 characters] - Unique key identifier

API Key Limits by Plan

PlanMax API KeysMonthly API CallsRate Limit
Trial25060/minute
Solo0No API accessN/A
Pro1010,00060/minute
EnterpriseUnlimitedUnlimitedCustom

Upgrade to Pro or Enterprise to access API features. View Plans →


Using API Keys

Authentication

Include your API key in the X-API-Key header:

curl -X GET https://api.pinebill.app/v1/invoices \
  -H "X-API-Key: pbk_live_your_api_key_here"

JavaScript/Node.js Example

const response = await fetch("https://api.pinebill.app/v1/invoices", {
  headers: {
    "X-API-Key": process.env.PINEBILL_API_KEY,
    "Content-Type": "application/json",
  },
});

const data = await response.json();

Python Example

import requests

headers = {
    'X-API-Key': 'pbk_live_your_api_key_here',
    'Content-Type': 'application/json'
}

response = requests.get(
    'https://api.pinebill.app/v1/invoices',
    headers=headers
)

data = response.json()

Revoking API Keys

1. Access API Keys Dashboard

  1. Go to API Keys
  2. Find the key to revoke
  3. Click Revoke or Delete button
Invoice Generator Overview

Owner Only: Only organization owners can revoke API keys. This prevents unauthorized key deletion.

2. Confirm Revocation

  1. Review the key name and last usage
  2. Confirm you want to revoke access
  3. Click Revoke Key

Monitoring API Key Usage

Usage Statistics

View detailed usage for each API key:

  1. Navigate to API Keys
  2. Click on a key to view details
  3. See usage statistics for the last 30 days

Available metrics:

  • Total requests in last 30 days
  • Daily request chart
  • Recent API calls (last 50)
  • Status code distribution
  • Most accessed endpoints

API Audit Logs

Track all API activity across your organization:

  • View all API requests from all keys
  • Filter by date, endpoint, or status code
  • Monitor for security issues
  • Debug API integration problems

Learn more about API Audit Logs →


Troubleshooting


API Keys | PineBill Documentation