Skip to main content

Authenticate to the API Portal REST API

OAuth2 (OAuth2Security)​

Bearer JWT access token, sent as Authorization: Bearer <token>. The API Portal issues no token of its own — where you obtain one depends on auth.mode.

Local auth mode (auth.mode = "local", the development default). The token comes from the Platform API the portal is configured against (auth.local.platform_api_url), whose login endpoint validates a file-configured username and password and returns a signed JWT:

TOKEN=$(curl -sk -X POST https://localhost:9243/api/portal/v0.9/auth/login \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'username=admin' -d 'password=admin' | jq -r .token)

curl -sk https://localhost:9543/api-portal/api/v0.9/apis \
-H "Authorization: Bearer $TOKEN"

The portal verifies that token against the Platform API's public key (auth.local.public_key_path), so both components must be pointed at the same key pair, and the portal's organization.handle must match the organization in the Platform API's file-auth configuration.

IDP mode (auth.mode = "idp"). The token comes from the OIDC identity provider configured under [api_portal.auth.idp] — obtained through that provider's own authorization code flow, not from the portal — see Get a bearer token via curl for a step-by-step walkthrough. Its authorization and token endpoints are the ones in your provider's .well-known/openid-configuration document — configure them as auth.idp.authorization_url and auth.idp.token_url.

Which scopes a caller holds depends on auth.authorization.mode. In the default role mode the token's own scope claim is ignored: its roles claim (named by auth.claim_mappings.roles) is expanded through the portal's role-to-scope grant table (auth.authorization.role_to_scope_mapping), so an identity provider that knows nothing about dp:* scopes can still authorize every operation. In scope mode the token must itself carry the scope — register the scopes below with your identity provider and request them at login.

ScopeScope Description
dp:organization:readRead organizations.
dp:organization:createCreate organizations.
dp:organization:updateUpdate organizations.
dp:organization:deleteDelete organizations.
dp:organization:manageManage organizations (including creating, updating, and deleting).
dp:organization_content:readRead organization theme assets.
dp:organization_content:manageApply or reset organization theme.
dp:api:readRead API metadata.
dp:api:createCreate API metadata.
dp:api:updateUpdate API metadata.
dp:api:deleteDelete API metadata.
dp:api:manageManage API metadata.
dp:api_content:readRead API content.
dp:api_content:createCreate API content.
dp:api_content:updateUpdate API content.
dp:api_content:deleteDelete API content.
dp:api_content:manageManage API content.
dp:mcp_server:readRead MCP server metadata.
dp:mcp_server:createCreate MCP server metadata.
dp:mcp_server:updateUpdate MCP server metadata.
dp:mcp_server:deleteDelete MCP server metadata.
dp:mcp_server:manageManage MCP server metadata.
dp:mcp_server_content:readRead MCP server content.
dp:mcp_server_content:createCreate MCP server content.
dp:mcp_server_content:updateUpdate MCP server content.
dp:mcp_server_content:deleteDelete MCP server content.
dp:mcp_server_content:manageManage MCP server content.
dp:mcp_server_key:readRead MCP server API keys.
dp:mcp_server_key:createGenerate MCP server API keys.
dp:mcp_server_key:updateRegenerate MCP server API keys.
dp:mcp_server_key:revokeRevoke MCP server API keys.
dp:mcp_server_key:manageManage MCP server API keys.
dp:subscription_plan:readRead subscription plans.
dp:subscription_plan:createCreate subscription plans.
dp:subscription_plan:updateUpdate subscription plans.
dp:subscription_plan:deleteDelete subscription plans.
dp:subscription_plan:manageManage subscription plans.
dp:label:readRead labels.
dp:label:createCreate labels.
dp:label:updateUpdate labels.
dp:label:deleteDelete labels.
dp:label:manageManage labels.
dp:application:readRead applications.
dp:application:createCreate applications.
dp:application:updateUpdate applications.
dp:application:deleteDelete applications.
dp:application:manageManage applications.
dp:subscription:readRead subscriptions.
dp:subscription:createCreate subscriptions.
dp:subscription:updateUpdate subscriptions.
dp:subscription:deleteDelete subscriptions.
dp:subscription:manageManage subscriptions.
dp:api_key:readRead API keys.
dp:api_key:createGenerate API keys.
dp:api_key:updateRegenerate API keys.
dp:api_key:revokeRevoke API keys.
dp:api_key:manageManage API keys.
dp:application_key_mapping:readRead application key mappings.
dp:application_key_mapping:createCreate application key mappings.
dp:application_key_mapping:manageManage application key mappings.
dp:view:readRead views.
dp:view:createCreate views.
dp:view:updateUpdate views.
dp:view:deleteDelete views.
dp:view:manageManage views.
dp:application_key:createGenerate and create application keys.
dp:application_key:updateUpdate application keys.
dp:application_key:revokeRevoke application keys.
dp:application_key:manageManage application keys.
dp:api_workflow:readRead API workflows.
dp:api_workflow:createCreate or generate API workflows.
dp:api_workflow:updateUpdate API workflows.
dp:api_workflow:deleteDelete API workflows.
dp:api_workflow:manageManage API workflows.
dp:event:readRead webhook events and delivery details.
dp:key_manager:readRead key manager configurations.
dp:key_manager:createCreate key manager configurations.
dp:key_manager:updateUpdate key manager configurations.
dp:key_manager:deleteDelete key manager configurations.
dp:key_manager:manageManage key manager configurations (including creating, updating, and deleting).
dp:webhook_subscriber:readRead webhook subscriber configurations.
dp:webhook_subscriber:createCreate webhook subscriber configurations.
dp:webhook_subscriber:updateUpdate webhook subscriber configurations.
dp:webhook_subscriber:deleteDelete webhook subscriber configurations.
dp:webhook_subscriber:manageManage webhook subscriber configurations (including creating, updating, and deleting).

Was this page helpful?