HomeGuidesAPI Reference
API Reference

Create ROLE

Create new Role, ACCESS LEVEL: SUPER_ADMIN, PARTNER, MERCHANT, BRANCH

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

This endpoint allows you to create a new role with a set of permissions.

Endpoint

POST https://demo-api.edfapay.com/api/v1/roles/role

Content-Type: application/json


Authentication

All requests to this endpoint must include a valid X-API-KEY in the request header for authentication. The X-API-KEY must be sent from the server side and should not be exposed on the client side.

How to generate API key


Request Parameters

FieldTypeRequiredDescription
roleNamestringYesName of the role
descriptionstringYesDescription of the role
permissionsarray[string]YesList of permissions assigned to the role

Permissions Format

Each permission is a string composed of: "<module>_<action>"

Example To allow reading users: "user_read"

📘

Available Permissions

Refer to the official documentation for the full list of permissions: 👉 Permissions


Example Request

curl --location 'https://demo-api.edfapay.com/api/v1/roles/role' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: YOUR_API_KEY' \
--data-raw '{
  "roleName": "Users Viewer",
  "description": "Views the users list",
  "permissions": [
    "user_read"
]
}'

Example Responses

{
    "code": 200,
    "message": "Success",
    "errorCode": null,
    "data": {
        "createdBy": null,
        "createdTimestamp": "2026-04-20T12:47:30.252128609Z",
        "updatedBy": null,
        "updatedTimestamp": "2026-04-20T12:47:30.252016969Z",
        "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "name": "Users Viewer",
        "description": "Views the users list",
        "businessUnitId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "permissions": [
            "USER_READ"
        ]
    }
}
{
    "code": 409,
    "message": "Entity Role already exist for fields [roleName, businessUnitId] and values [Users Viewer, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx]",
    "errorCode": "409",
    "data": null
}

🚧

Important Notes

permissions must exactly match the supported values. Any incorrectly formatted permission will be ignored and not assigned to the role.

roleName must be unique and must not have been used previously.

Body Params
string
string
permissions
array of strings
permissions
Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Choose an example:
*/*