ByteChef LogoByteChef
Embedded

Permission Expressions

Control which integrations, automation projects and workflows each connected user sees with a SpEL expression evaluated against the user's identity and metadata.

A permission expression controls which connected users see an integration, an automation project or one of their workflows in an embedded deployment. ByteChef evaluates the expression per connected user at request time. Typical uses: offer a premium integration only to paying plans, hide an integration from customers in a region it does not support, or limit a beta workflow to flagged accounts. Tenant admins set expressions when they build integrations and automations.

Permission expressions are an Enterprise Edition feature. They control visibility for connected users (the end users of your product who authenticate through your backend), not for the admins who build integrations in the ByteChef UI.

How it works

Each integration, each automation project, and each of their workflows carries an optional permission expression: a SpEL expression that must evaluate to true for the requesting connected user to see that resource.

When your product lists the integrations or automation projects available to a connected user, the platform evaluates each expression against that user's identity and metadata and filters out anything that doesn't pass.

Connected user requests their integrations / automation projects
        │
        ▼
For each integration / project / workflow:
  permission expression blank? ──► visible
  expression evaluates to true? ──► visible
  anything else (false or error) ──► hidden

Fail-closed semantics

The evaluator fails closed, which is the safe default for an access decision:

  • A blank or absent expression means no restriction: the resource is visible to everyone.
  • An expression that evaluates to true makes the resource visible.
  • Anything else hides it: false, a malformed expression, a null dereference or any other evaluation error. A typo in an expression hides the resource rather than exposing it.

What the expression can reference

The expression is evaluated against a context built from the requesting connected user:

VariableTypeMeaning
metadatamap of string to stringThe key/value metadata your backend attached to the connected user, such as plan tier, region or account ID. Values are stored as strings, whatever JSON type you sent, so compare against a quoted literal.
externalIdstringThe user's ID in your system: the external user ID (the JWT sub claim).
emailstringThe connected user's email.
namestringThe connected user's display name.
environmentstringThe environment name (DEVELOPMENT, STAGING, PRODUCTION) the request is scoped to.

Most expressions use metadata. Your backend writes it with PATCH /api/embedded/v1/me (end-user JWT) or PATCH /api/embedded/v1/{externalUserId} (API Key), sending a flat JSON object; name and email are lifted onto the connected user and everything else is stored as metadata. This lets you base visibility on your own entitlement model.

For example, your backend records a user's plan and region:

curl -X PATCH "https://your-bytechef-host.example.com/api/embedded/v1/user-123" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Environment: PRODUCTION" \
  -d '{"email": "ada@example.com", "plan": "enterprise", "region": "eu"}'

For that user, email is ada@example.com, externalId is user-123, environment is PRODUCTION, and metadata holds plan and region. This expression evaluates to true, so the resource is visible to them:

metadata['plan'] == 'enterprise' && metadata['region'] == 'eu'

A user whose metadata has no plan key gets null for metadata['plan'], so the comparison is false and the resource stays hidden.

Examples

Show an integration only to paid plans:

metadata['plan'] == 'pro' || metadata['plan'] == 'enterprise'

Restrict a workflow to a specific region:

metadata['region'] == 'eu'

Limit a beta integration to flagged accounts (metadata values are strings, so quote the literal):

metadata['betaIntegrations'] == 'true'

Limit a sensitive integration to internal users by email domain:

email != null && email.endsWith('@yourcompany.com')

Setting an expression in the UI

Each expression is a multi-line Permission Expression text field, scoped to the resource it gates. Leaving it empty means no restriction.

Integrations:

  • In Embedded > Integrations, the Create Integration and Edit Integration dialogs have a Permission Expression field. It applies to the whole integration.
  • In the integration's workflow list, open a workflow's menu and choose Edit. The workflow dialog has its own Permission Expression field, so you can restrict individual workflows inside an otherwise visible integration.

Automation projects:

  • The Create Project and Edit Project dialogs (in Embedded > Automations) have a project-level Permission Expression field.
  • The Create Workflow and Edit Workflow dialogs have a workflow-level Permission Expression field.

Configurations:

  • Integration instance configurations and automation project configurations have an Assignment rule field. It takes the same expressions, but it does not hide anything. It decides which configuration self-serve places a new user on, and it is checked only once, when the user is first assigned. See Several configurations in one environment.

Setting an expression through the admin API

You can also set the expressions through the admin GraphQL API, scoped to the resource they apply to.

Integrations:

  • The integration-level expression is set as part of the integration update (a permissionExpression field on the integration), so it is saved together with the rest of the integration in a single write.
  • updateIntegrationWorkflowPermissionExpression sets the expression on a single workflow within an integration.

Automation projects:

  • The project-level expression is folded into createAutomationProject / updateAutomationProject as a permissionExpression argument, so it is saved with the rest of the project in a single write. A null argument leaves any stored expression unchanged; an empty string clears it.
  • A workflow's expression can be passed on createAutomationProjectWorkflow, and changed later with updateAutomationProjectWorkflowPermissionExpression.

A workflow-level expression lets you offer an integration or automation project broadly while restricting individual workflows inside it. For example, the project is visible to everyone, but its "bulk export" workflow only to enterprise accounts. The project-level expression behaves like the integration-level one: when it evaluates false, the whole project (and all its workflows) drops out of that connected user's catalog.

Where it fits

Permission expressions are a visibility filter, not a security boundary on execution. They decide what a connected user is offered. Tenant-isolated security is what keeps one tenant from reaching another's data or credentials. Use expressions to shape each customer's catalog, and rely on tenant isolation for data separation.

How is this guide?

Last updated on

On this page