API reference

Permissions

Roles, permissions and effective scopes. What explains a 403.

Effective permissions

GETapi.niucore.com/api/v1/me/permissions

Scope: permissions:read

The user's current permissions and the credential's effective scopes, together. This is what explains a 403.

curl -sS -X GET 'https://api.niucore.com/api/v1/me/permissions' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": {
    "permissions": [
      "sidebar.chat",
      "workspaces.read.all",
      "skills.read.all"
    ],
    "scopes": [
      "chat:read",
      "chat:write",
      "libraries:read"
    ]
  },
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
  }
}

List permissions

GETapi.niucore.com/api/v1/permissions

Scope: permissions:read

The credential's effective permissions, as a paginated collection.

Note

It does not return the platform's full catalog: publishing it would tell any credential which features exist and what they are called.

Query

pageintegerdefaults to 1

Page number, starting at 1.

sizeintegerdefaults to 50

Items per page. Maximum 200.

curl -sS -X GET 'https://api.niucore.com/api/v1/permissions' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": [
    {
      "code": "sidebar.chat"
    },
    {
      "code": "workspaces.read.all"
    },
    {
      "code": "skills.read.all"
    }
  ],
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77",
    "page": 1,
    "size": 50,
    "total": 3
  }
}

List roles

GETapi.niucore.com/api/v1/roles

Scope: permissions:read

Roles defined in the company.

Query

pageintegerdefaults to 1

Page number, starting at 1.

sizeintegerdefaults to 50

Items per page. Maximum 200.

curl -sS -X GET 'https://api.niucore.com/api/v1/roles' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": [
    {
      "id": 3,
      "name": "Administrador",
      "description": "Acceso total a la empresa."
    },
    {
      "id": 5,
      "name": "Supervisor",
      "description": "Gestiona su área."
    }
  ],
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77",
    "page": 1,
    "size": 50,
    "total": 2
  }
}

Retrieve a role

GETapi.niucore.com/api/v1/roles/{role_id}

Scope: permissions:read

Detail of one role with its permissions.

Path

role_idintegerrequired

Role identifier.

Errors

  • 404api_v1_not_foundThe role does not exist in the company.
curl -sS -X GET 'https://api.niucore.com/api/v1/roles/5' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": {
    "id": 5,
    "name": "Supervisor",
    "description": "Gestiona su área.",
    "permissions": [
      "sidebar.chat",
      "workspaces.read.area",
      "metrics.read.area"
    ]
  },
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
  }
}