Skip to content

Roles & Permissions API

Pro Feature

All roles and permissions endpoints require FluentCart Pro.

Manage custom roles, assign permissions, and control user access to FluentCart features.

Base URL: https://your-site.com/wp-json/fluent-cart/v2/roles

Policy: AdminPolicy

The AdminPolicy requires the current user to have the is_super_admin permission (WordPress manage_options capability). All endpoints in this group are restricted to site administrators.


List Managers

GET /fluent-cart/v2/roles/managers

Retrieve a list of all WordPress users who have been assigned a FluentCart shop role. Returns user details along with their assigned role and resolved permissions.

Response

json
{
  "managers": [
    {
      "id": 5,
      "email": "[email protected]",
      "display_name": "Jane Manager",
      "username": "janemanager",
      "shop_role": "manager",
      "description": "With All Permissions Except Sensitive Settings",
      "registered_at": "2025-03-10 08:00:00",
      "role_permissions": [
        "store/settings",
        "products/view",
        "products/create",
        "products/edit",
        "products/delete",
        "customers/view",
        "customers/manage",
        "customers/delete",
        "orders/view",
        "orders/manage_statuses",
        "orders/can_refund",
        "orders/manage",
        "orders/export",
        "orders/delete",
        "subscriptions/view",
        "subscriptions/manage",
        "subscriptions/delete",
        "licenses/view",
        "licenses/manage",
        "licenses/delete",
        "coupons/view",
        "coupons/manage",
        "coupons/delete",
        "reports/view",
        "reports/export",
        "integrations/view",
        "integrations/manage",
        "integrations/delete"
      ]
    }
  ]
}

Response Fields

FieldTypeDescription
idintegerWordPress user ID
emailstringUser email address
display_namestringWordPress display name
usernamestringWordPress login username
shop_rolestringAssigned FluentCart role key (e.g., manager, worker, accountant)
descriptionstringHuman-readable description of the role
registered_atstringWordPress user registration date
role_permissionsarrayResolved list of permission strings for this user's role

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/roles/managers" \
  -u "username:app_password"

Search Users

GET /fluent-cart/v2/roles/user-list

Search for WordPress users who can be assigned a FluentCart role. Returns users matching the search query, excluding those who already have a WordPress administrator role.

Parameters

ParameterTypeLocationRequiredDescription
searchstringqueryNoSearch by display name or email address. Partial matches supported.
user_idsstring/arrayqueryNoComma-separated user IDs to include in results regardless of search filter

Response

json
{
  "users": {
    "total": 25,
    "per_page": 15,
    "current_page": 1,
    "last_page": 2,
    "data": [
      {
        "ID": 10,
        "name": "Alice Johnson",
        "email": "[email protected]"
      },
      {
        "ID": 15,
        "name": "Bob Wilson",
        "email": "[email protected]"
      }
    ]
  }
}

Response Fields

FieldTypeDescription
IDintegerWordPress user ID
namestringWordPress display name
emailstringUser email address

Users who already have the WordPress manage_options capability (administrators) are excluded from results, as they automatically have full FluentCart access.

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/roles/user-list?search=alice" \
  -u "username:app_password"

List Roles

GET /fluent-cart/v2/roles

Retrieve all available FluentCart roles with their titles and descriptions. This returns the role definitions (not user assignments).

Response

json
{
  "roles": {
    "super_admin": {
      "title": "Super Admin",
      "description": "With All Permissions"
    },
    "manager": {
      "title": "Manager",
      "description": "With All Permissions Except Sensitive Settings"
    },
    "worker": {
      "title": "Worker",
      "description": "View Access for products, customers, coupons, integrations. Manage Access for Order Statuses"
    },
    "accountant": {
      "title": "Accountant",
      "description": "View Access for products, customers, orders, subscriptions, licenses, coupons, reports and integrations"
    }
  }
}

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/roles" \
  -u "username:app_password"

Assign Role

POST /fluent-cart/v2/roles

Assign a FluentCart role to a WordPress user. The user receives the fluent_cart_admin capability and their role is stored as user meta. If the user already has an assigned role, it is replaced.

Parameters

ParameterTypeLocationRequiredDescription
user_idintegerbodyYesWordPress user ID. Must reference an existing user.
role_keystringbodyYesThe role key to assign. Must be one of the valid role keys returned by the List Roles endpoint (e.g., super_admin, manager, worker, accountant). Max 50 characters.

Response

Success (200):

json
{
  "message": "Role synced successfully",
  "is_updated": true
}

Error Responses

ScenarioMessage
User not foundUser not found.
Invalid role keyInvalid role.
User is WP administratorThe user already has all the accesses as part of Administrator Role

Validation Rules

FieldRuleMessage
user_idrequired, must exist as userTitle is required.
role_keyrequired, string, max:50, must be valid roleKey is required.

Example

bash
curl -X POST "https://example.com/wp-json/fluent-cart/v2/roles" \
  -u "username:app_password" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 10,
    "role_key": "manager"
  }'

Get Role

GET /fluent-cart/v2/roles/{key}

Retrieve details for a specific role by its key.

Parameters

ParameterTypeLocationRequiredDescription
keystringpathYesThe role key (e.g., manager, worker, accountant)

This endpoint is currently a placeholder and returns no data. It is reserved for future use.

Example

bash
curl -X GET "https://example.com/wp-json/fluent-cart/v2/roles/manager" \
  -u "username:app_password"

Update Role

POST /fluent-cart/v2/roles/{key}

Update a specific role definition.

Parameters

ParameterTypeLocationRequiredDescription
keystringpathYesThe role key to update

This endpoint is currently a placeholder and returns no data. It is reserved for future use.

Example

bash
curl -X POST "https://example.com/wp-json/fluent-cart/v2/roles/manager" \
  -u "username:app_password" \
  -H "Content-Type: application/json" \
  -d '{}'

Delete Role Assignment

DELETE /fluent-cart/v2/roles/{key}

Remove a FluentCart role assignment from a user. The user's fluent_cart_admin capability is removed and their role meta is deleted. The user's WordPress account is not affected.

Parameters

ParameterTypeLocationRequiredDescription
keystringpathYesThe role key to remove (e.g., manager, worker)
user_idintegerbody/queryYesThe WordPress user ID to remove the role from

Response

Success (200):

json
{
  "message": "Role deleted successfully"
}

Error Responses

ScenarioMessage
Missing role keyRole key is required
User not foundUser not found
User is WP administratorThe user already has all the accesses as part of Administrator Role

Example

bash
curl -X DELETE "https://example.com/wp-json/fluent-cart/v2/roles/manager" \
  -u "username:app_password" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 10
  }'

Role Definitions

FluentCart includes four built-in roles with predefined permission sets:

super_admin

Full access to all FluentCart features and settings.

CategoryPermissions
Storestore/settings, store/sensitive
Productsproducts/view, products/create, products/edit, products/delete
Customerscustomers/view, customers/manage, customers/delete
Ordersorders/view, orders/create, orders/manage_statuses, orders/manage, orders/can_refund, orders/export, orders/delete
Subscriptionssubscriptions/view, subscriptions/manage, subscriptions/delete
Licenseslicenses/view, licenses/manage, licenses/delete
Couponscoupons/view, coupons/manage, coupons/delete
Reportsreports/view, reports/export
Integrationsintegrations/view, integrations/manage, integrations/delete
Labelslabels/view, labels/manage, labels/delete
Dashboarddashboard_stats/view

manager

All permissions except sensitive store settings (store/sensitive).

worker

Limited access focused on day-to-day operations:

  • View products, customers, orders, subscriptions, licenses, integrations
  • Manage order statuses
  • View and manage coupons

accountant

Read-only access with export capabilities:

  • View products, customers, orders, subscriptions, licenses, coupons, integrations
  • View and export orders
  • View and export reports

HookTypeDescription
fluent_cart/permission/all_rolesFilterModify or extend the available role definitions. Receives the roles array.

FluentCart developer documentation