Ctrl K
ring2all.com

API Keys Module Documentation

Table of Contents

  1. Module Overview (Technical)
  2. Module Overview (Commercial/Business)
  3. Module Overview (End User/Administrator)
  4. Configuration Sections
  5. Settings Reference
  6. Common Scenarios & Examples
  7. Limitations & Important Notes
  8. Troubleshooting Tips
  9. Glossary

---

1. Module Overview (Technical)

What Are API Keys?

API Keys is a REST API authentication module that manages tokens for programmatic access to the Ring2All API. Each key can be scoped to specific tenants/domains and optionally have an expiration date.

Architecture

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│                API Keys Architecture                           │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  API Key Definition                                             │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        API Key: CRM Integration                          │   │
│  │                                                          │   │
│  │  Key: r2a_xxxx...xxxx (shown once)                      │   │
│  │  Prefix: r2a_                                           │   │
│  │  Scope: Tenant-specific (main)                          │   │
│  │  Domain: All Domains                                     │   │
│  │  Expires: 2025-12-31                                    │   │
│  │  Status: Active                                          │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Used in API requests                                   │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        API Request                                       │   │
│  │                                                          │   │
│  │  GET /api/v1/extensions                                 │   │
│  │  Authorization: Bearer r2a_xxxx...xxxx                  │   │
│  │  X-Tenant-Slug: main                                    │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Validated by                                           │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        API Gateway                                       │   │
│  │                                                          │   │
│  │  Checks:                                                 │   │
│  │  ├─ Key exists and active                               │   │
│  │  ├─ Key not expired                                     │   │
│  │  ├─ Tenant scope matches request                        │   │
│  │  └─ Domain scope matches (if restricted)                │   │
│  │                                                          │   │
│  │  Result: Allow or 401 Unauthorized                      │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Key Tables

TablePurpose
public.api_keysAPI key records

Key Files

FileDescription
modules/apiKeys/Frontend module
---

2. Module Overview (Commercial/Business)

Business Value

API Keys provides secure programmatic access:

Without API KeysWith API Keys
No automationFull API access
Manual operationsScripted workflows
No integrationsCRM/ERP integration
Password sharingSecure tokens

Use Cases

  1. Third-party Integration
- CRM systems

- Billing platforms

- Custom dashboards

  1. Automation
- Provisioning scripts

- Bulk operations

- Scheduled tasks

  1. Multi-tenant Access
- Global keys for system integrations

- Tenant-specific for isolated access

  1. Security Compliance
- Expiration policies

- Key rotation

- Audit trail

Feature Highlights

FeatureBenefit
Secure KeysOne-time reveal
Tenant ScopeGlobal or specific
Domain ScopeGranular access
ExpirationAuto-disable old keys
Status ToggleEnable/disable
PrefixIdentify key type
---

3. Module Overview (End User/Administrator)

What Can You Do?

  • Create API keys for integrations
  • Set tenant scope (global or specific)
  • Restrict to specific domains
  • Set expiration dates
  • Enable/disable keys
  • Copy key on creation (one-time)
  • Track last usage

API Keys Interface

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              API Keys                                           │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  [+ Create API Key]                                             │
│                                                                 │
│  [🔍 Search API keys...]                                        │
│                                                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ Name            │ Prefix  │ Scope    │ Expires  │ Status │  │
│  ├─────────────────┼─────────┼──────────┼──────────┼────────┤  │
│  │ CRM Integration │ r2a_abc │ main     │ 2025-12  │ Active │  │
│  │ Billing System  │ r2a_def │ Global   │ Never    │ Active │  │
│  │ Old Script      │ r2a_ghi │ branch   │ 2024-06  │ Expired│  │
│  │ Test Key        │ r2a_jkl │ main     │ Never    │ Inactive│ │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Create API Key

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              Create API Key                                     │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ▼ Basic Information                                            │
│                                                                 │
│  API Key Name: [CRM Integration              ]                 │
│    Unique name for identifying this API key                     │
│                                                                 │
│  Description: [Integration with Salesforce   ]                 │
│    Optional note describing the purpose                         │
│                                                                 │
│  ──────────────────────────────────────────────────────────────│
│                                                                 │
│  Tenant:                                                        │
│  ○ Global (All Tenants)                                        │
│      The API key can access every tenant.                       │
│  ● Tenant-specific                                             │
│      The API key can only access the selected tenant.          │
│                                                                 │
│  Select Tenant: [main ▼]                                       │
│                                                                 │
│  Domain Scope: [All Domains ▼]                                 │
│    When a tenant is selected, you can further restrict         │
│    access to a specific domain.                                 │
│                                                                 │
│  ──────────────────────────────────────────────────────────────│
│                                                                 │
│  Expiration: [2025-12-31    ]                                  │
│    Leave blank for a key without expiration.                    │
│                                                                 │
│  Active: ✓                                                     │
│    Disabled keys are rejected by the API.                       │
│                                                                 │
│  [Create API Key] [Cancel]                                      │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Generated Key (Shown Once)

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              🔒 Generated API Key                               │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  🔒 Your API Key (hover to reveal)                              │
│                                                                 │
│  ┌─────────────────────────────────────────────────────────────┐│
│  │ r2a_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0...         [📋]││
│  └─────────────────────────────────────────────────────────────┘│
│                                                                 │
│  ⚠️ Important: This is the only time you will see this API key │
│  in full. Store it securely!                                    │
│                                                                 │
│  Usage: Authorization: Bearer r2a_a1b2c3d4e5f6g7h8...          │
│                                                                 │
│  [Close]                                                        │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Quick Tips

TIP
Copy Immediately: Key is shown only once during creation.
TIP
Use Expiration: Enforce key rotation for security.
WARNING
Store Securely: Keys cannot be retrieved after creation.

---

4. Configuration Sections

Basic Information

FieldDescription
API Key NameUnique identifier
DescriptionPurpose notes
ActiveEnable/disable key

Scope Settings

FieldDescription
TenantGlobal or specific tenant
Domain ScopeAll domains or specific

Security Settings

FieldDescription
ExpirationOptional expiration date
---

5. Settings Reference

Tenant Scope Options

OptionDescription
GlobalAccess all tenants
Tenant-specificAccess one tenant only

Status Values

StatusDescription
ActiveKey is valid
InactiveManually disabled
ExpiredPast expiration date

API Usage

Bash
# Request with API key
curl -X GET "https://api.ring2all.com/v1/extensions" \
  -H "Authorization: Bearer r2a_your_api_key_here" \
  -H "X-Tenant-Slug: main"

---

6. Common Scenarios & Examples

Scenario 1: Create Integration Key

  1. Click "Create API Key"
  2. Name = "CRM Integration"
  3. Description = "Salesforce contact sync"
  4. Scope = Tenant-specific, select tenant
  5. Expiration = 1 year from now
  6. Click Create
  7. Copy the key immediately
  8. Configure in CRM

Scenario 2: Global System Key

  1. Click "Create API Key"
  2. Name = "System Automation"
  3. Scope = Global (All Tenants)
  4. Expiration = None
  5. Create and copy key

Scenario 3: Disable Old Key

  1. Find key in list
  2. Click Edit
  3. Uncheck "Active"
  4. Save

Scenario 4: Key Rotation

  1. Create new key (same purpose)
  2. Update integration with new key
  3. Verify new key works
  4. Delete old key

---

7. Limitations & Important Notes

Technical Notes

NOTE
One-time Display: Key shown only at creation.
NOTE
Cannot Retrieve: Lost keys require new key creation.
WARNING
Secure Storage: Store keys in secure credential managers.

Best Practices

  1. Unique Keys: One key per integration
  2. Descriptive Names: "CRM_Salesforce_Prod"
  3. Set Expiration: Enforce rotation
  4. Least Privilege: Tenant-specific when possible
  5. Rotate Regularly: Replace keys periodically

Security Recommendations

PracticeDescription
Key RotationReplace keys every 90 days
Environment VarsDon't hardcode keys
Audit UsageMonitor last used dates
Disable UnusedDeactivate unused keys
---

8. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
401 UnauthorizedKey inactiveCheck status
401 UnauthorizedKey expiredCreate new key
403 ForbiddenWrong tenantCheck scope
Key lostNot savedCreate new key

Test API Key

Bash
# Verify key works
curl -I "https://api.ring2all.com/v1/health" \
  -H "Authorization: Bearer r2a_your_key"

# Expected: HTTP 200 OK

Check Key in Database

Sql
SELECT 
  name,
  prefix,
  tenant_scope,
  is_active,
  expires_at,
  last_used_at
FROM public.api_keys
WHERE name = 'CRM Integration';

---

9. Glossary

TermDefinition
API KeyAuthentication token
Bearer TokenAuthorization header format
Tenant ScopeAccess restriction
PrefixKey identifier (r2a_)
ExpirationAuto-disable date
Key RotationRegular key replacement
---

Lua Script Status ℹ️

Admin Module

ComponentStatus
API Keysℹ️ REST API authentication - no Lua handler required
API Keys is an administration module. Keys authenticate REST API requests. No Lua handlers are used - authentication is handled by the backend API middleware.

---

Documentation last updated: January 2026
AI Assistant

👋 Hello! I'm your Ring2All documentation assistant. I can help you find information about configuring and using the Ring2All PBX platform.

How can I help you today?