API Key Lifecycle

API keys allow external applications and scripts to access the Otesse API on behalf of your organization. Each key is scoped with specific permissions, expires on a configurable schedule, and logs every request for monitoring. This page covers the complete lifecycle of an API key from generation through rotation and revocation.

Generating an API Key

Step 1: Open the Create Modal

Navigate to Settings > Integrations > API Keys and click "Generate API Key."

Step 2: Configure the Key

FieldDescriptionOptions
NameDescriptive identifier (must be unique among active keys)Free text, 1-100 characters
DescriptionOptional explanation of the key's purposeFree text, 0-500 characters
Permission ScopeBroad access levelRead-Only, Read-Write, or Admin
Granular ScopesSpecific permissions within the access levelChecklist grouped by resource
ExpirationWhen the key stops working30 days, 90 days, 1 year, or Never

Step 3: Review and Generate

Click "Generate API Key." The system creates a cryptographically random key in the format:

erp_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0

The key consists of three parts:

  • erp — Prefix identifying it as an Otesse API key
  • live or test — Environment indicator
  • 40 characters of base62 random data

Step 4: Copy the Key

The key is displayed exactly once in a modal with a copy-to-clipboard button. After you close this modal, the key is never shown again — the system stores only a SHA-256 hash for authentication.

If you close the modal without copying, a confirmation dialog warns: "Are you sure? This key will not be shown again."

Permission Scopes

Scope Levels

LevelAccessUse Case
Read-OnlyGET endpoints onlyReporting dashboards, analytics integrations, monitoring
Read-WriteGET, POST, PUT, PATCH, DELETE on standard endpointsSync integrations, mobile apps, automation workflows
AdminFull access including settings, user management, and billingAdministrative tools, superuser scripts

Granular Scopes

Within each level, you select specific resource permissions:

ScopeDescription
customers.read / customers.writeList, view, create, update, delete customers
invoices.read / invoices.writeManage invoices
payments.read / payments.writeProcess and view payments
jobs.read / jobs.writeManage jobs and work orders
products.read / products.writeManage products and services
employees.read / employees.writeManage employee records
reports.readGenerate and view reports
settings.read / settings.writeView and modify organization settings
webhooks.manageCreate, update, delete webhook subscriptions
integrations.manageManage integration connections

Scopes marked as sensitive (like settings.write and employees.write) display a warning icon and require admin role to grant.

Viewing and Managing Keys

The API Keys tab displays all keys for your organization:

ColumnDescription
NameKey identifier (clickable to open detail view)
KeyMasked display: erplive...s9t0 (last 4 characters)
Scope LevelRead-Only, Read-Write, or Admin (color-coded badge)
CreatedCreation timestamp
ExpiresExpiration date (red if within 7 days)
Last UsedMost recent API request timestamp
StatusActive, Expired, or Revoked

Key Detail View

Click any key name to see:

  • Full configuration (name, description, scope level, creation details)
  • List of all granted scopes with descriptions
  • Usage summary (total requests, unique IP addresses, last used)
  • Recent usage log (last 50 requests with endpoint, method, status code, response time)

Key Rotation

API keys cannot have their expiration extended. To rotate a key:

  1. Generate a new key with the same scopes
  2. Update the external application to use the new key
  3. Verify the new key works by checking usage logs
  4. Revoke the old key

This ensures a clean transition with no window where both keys must be valid simultaneously — though both keys work during the transition period.

Revoking a Key

Revocation is immediate and irreversible:

  1. Click "Revoke" on the key row or in the detail view
  2. Confirm in the dialog: "Revoking this key will immediately disable all API access using it"
  3. If the key was used in the last 24 hours, an additional warning appears
  4. On confirmation, the key is immediately disabled

Revoked keys remain in the list for audit purposes but cannot be reactivated. Any API request using a revoked key receives 401 Unauthorized with the message: "This API key has been revoked."

Expiration Warnings

The system sends advance warnings before a key expires:

TimingNotification
14 days beforeIn-app notification to the key creator
7 days beforeIn-app notification + email to organization admins
1 day beforeIn-app notification + email to organization admins

Limits

LimitValue
Maximum active keys per organization25
Key name length1-100 characters
Description length0-500 characters
Key formaterp{env}{40 chars base62}