Authentication

Create LeenOps API keys and understand REST scopes and MCP permissions.

Third-party REST and MCP integrations authenticate with a workspace API key:

Authorization: Bearer lnp_your_api_key

The first-party /api/v1 routes also accept a verified LeenOps session JWT. Use an API key for external integrations.

Create an External Connection

  1. Open Settings > Administration > API & MCP.
  2. Click Create External Connection.
  3. Name the connection and choose the smallest useful access preset or scope set.
  4. Leave optional user delegation off unless the integration needs person-bound tools such as my tasks or my time entries.
  5. Optionally set an expiry date.
  6. Copy the key immediately. It is shown only once.

The canonical settings URL is:

https://workspace.leenops.com/settings/administration/api

New keys start with lnp_. Legacy wks_ keys remain accepted during the compatibility period.

LeenOps automatically creates a stable, non-login service identity for the connection. No bot user or workspace member is required. Read External Connection Identities before enabling optional user delegation.

REST example

curl "https://workspace.leenops.com/api/v1/crm/contacts?page=1&limit=10" \
  -H "Authorization: Bearer $LEENOPS_API_KEY" \
  -H "Accept: application/json"

REST scope catalog

Write scopes also satisfy their matching read scope.

ModuleRead scopeWrite scope
Support ticketstickets.readtickets.write
CRM shared resourcescrm.readcrm.write
CRM contactscontacts.readcontacts.write
CRM dealsdeals.readdeals.write
Projectsprojects.readprojects.write
Issues/tasksissues.readissues.write
Planningplanning.readplanning.write
Assetsassets.readassets.write
Bookingsbookings.readbookings.write
Field servicefsm.readfsm.write
Goalsgoals.readgoals.write
Marketingmarketing.readmarketing.write
Procurementprocurement.readprocurement.write
Stockstock.readstock.write
Subscriptionssubscriptions.readsubscriptions.write
Surveyssurveys.readsurveys.write
Timetime.readtime.write
Documentsdocuments.readdocuments.write
Contractscontracts.readcontracts.write
Formsforms.readforms.write

Do not use older granular stock names such as stock.products.read or stock.movements.write; they are not valid key scopes.

REST requests require a matching read or write scope. A matching write scope also satisfies reads for that area. If a valid key receives 403, create or rotate to a key with the smallest scope listed by the endpoint guide.

MCP permissions

MCP tools use granular permissions such as read_contacts, documents.record.view, documents.record.manage, contracts.contract.view, and contracts.template.manage. The server derives those permissions from the key's scope preset unless the key stores an explicit permission map.

Inspect the exact effective permissions and tools for a key:

curl "https://workspace.leenops.com/api/mcp/session" \
  -H "Authorization: Bearer $LEENOPS_API_KEY"

See MCP tool discovery for the complete permission-aware tool list and schemas.

Authentication failures

StatusMeaning
401Missing, malformed, inactive, expired, or unknown key
403Valid key but the requested read, mutation, or tool needs another scope or permission
429Rate limit, monthly quota, or agent-trial tool quota reached

Workspace suspension, deletion, or lifecycle restrictions can also make an otherwise valid key unavailable.

Revoke and rotate

Revocation is immediate and irreversible. Rotation replaces the credential while preserving the connection's stable service identity and audit history. Copy the rotated key into the integration, verify it with /api/mcp/session or a read-only REST request, and remove the previous secret from the client.

Use separate keys per client, set expiries for temporary tests, and never place keys in URLs, screenshots, commits, browser bundles, or shared logs.