Skip to main content
This page covers the endpoints for viewing your organization’s team and managing its role-based access control (RBAC) configuration. The built-in roles — owner, admin, billing, and member — are protected and cannot be modified or deleted. You can create custom roles (e.g., auditor, marketing) and assign specific permissions to them.

List members and pending invites

Returns all active members and all outstanding invitations for the organization.

Endpoint

GET https://api.nyotaimara.com/v1/organizations/:id/members

Headers

Authorization
string
required
Bearer token. Format: Bearer <token>.
X-Organization-Id
string
required
The ID of the organization to query. Must match the :id path parameter.

Path parameters

id
string
required
The unique identifier of the organization.

Response

success
boolean
required
true on success.
data
object
curl --request GET \
  --url https://api.nyotaimara.com/v1/organizations/org_01j9kxyz/members \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Organization-Id: org_01j9kxyz'
{
  "success": true,
  "data": {
    "members": [
      {
        "id": "usr_abc123",
        "name": "Amina",
        "email": "amina@acmekenya.co.ke",
        "avatarUrl": "https://cdn.nyotaimara.com/avatars/amina.jpg",
        "role": "owner",
        "joinedAt": "2024-01-15T09:30:00.000Z"
      }
    ],
    "invites": [
      {
        "id": "inv_xyz789",
        "email": "john@acmekenya.co.ke",
        "role": "admin",
        "expiresAt": "2024-02-01T09:30:00.000Z"
      }
    ]
  }
}

Get roles and permissions

Returns all roles available to the organization and the full list of permissions that can be assigned to custom roles.

Endpoint

GET https://api.nyotaimara.com/v1/organizations/iam/roles

Headers

Authorization
string
required
Bearer token. Format: Bearer <token>.
X-Organization-Id
string
required
Active organization context.

Response

success
boolean
required
true on success.
data
object
curl --request GET \
  --url https://api.nyotaimara.com/v1/organizations/iam/roles \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Organization-Id: org_01j9kxyz'
{
  "success": true,
  "data": {
    "roles": [
      {
        "id": "role_owner",
        "name": "owner",
        "isProtected": true,
        "permissions": ["perm_org_update", "perm_member_invite", "perm_member_read"]
      },
      {
        "id": "role_auditor",
        "name": "auditor",
        "isProtected": false,
        "permissions": ["perm_member_read"]
      }
    ],
    "permissions": [
      { "id": "perm_org_update", "name": "org:organization:update" },
      { "id": "perm_member_invite", "name": "org:member:invite" },
      { "id": "perm_member_read", "name": "org:member:read" }
    ]
  }
}

Create a custom role

Creates a new custom role for the organization and optionally assigns permissions to it.

Endpoint

POST https://api.nyotaimara.com/v1/organizations/iam/roles

Headers

Authorization
string
required
Bearer token. Format: Bearer <token>.
X-Organization-Id
string
required
Active organization context.

Body

name
string
required
Name of the new role. The value is lowercased and non-alphanumeric characters (except underscores) are replaced with underscores. Reserved names (owner, admin, billing, member) are rejected.
description
string
Human-readable description of the role’s purpose.
permissionIds
string[]
Array of permission IDs to assign to this role. Retrieve available IDs from GET /v1/organizations/iam/roles.

Response

success
boolean
required
true on successful creation.
message
string
Confirmation message, e.g. "Organization role 'auditor' created successfully.".
curl --request POST \
  --url https://api.nyotaimara.com/v1/organizations/iam/roles \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Organization-Id: org_01j9kxyz' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "auditor",
    "description": "Read-only access to financial and compliance data",
    "permissionIds": ["perm_member_read", "perm_kyb_read"]
  }'
{
  "success": true,
  "message": "Organization role 'auditor' created successfully."
}

Update a custom role’s permissions

Replaces all permissions assigned to a custom role. The existing permission set is fully replaced — include every permission you want the role to have.

Endpoint

PATCH https://api.nyotaimara.com/v1/organizations/iam/roles/:roleId

Headers

Authorization
string
required
Bearer token. Format: Bearer <token>.
X-Organization-Id
string
required
Active organization context.

Path parameters

roleId
string
required
The ID of the role to update.

Body

permissionIds
string[]
required
Complete list of permission IDs to assign to the role. The previous permissions are replaced atomically.

Response

success
boolean
required
true on success.
message
string
Confirmation message.
Protected roles (owner, admin, billing, member) cannot be updated. Attempting to do so returns a 403 Forbidden error.
curl --request PATCH \
  --url https://api.nyotaimara.com/v1/organizations/iam/roles/role_auditor \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Organization-Id: org_01j9kxyz' \
  --header 'Content-Type: application/json' \
  --data '{
    "permissionIds": ["perm_member_read", "perm_kyb_read", "perm_org_read"]
  }'
{
  "success": true,
  "message": "Role 'auditor' permissions updated."
}

Delete a custom role

Permanently deletes a custom role from the organization.

Endpoint

DELETE https://api.nyotaimara.com/v1/organizations/iam/roles/:roleId

Headers

Authorization
string
required
Bearer token. Format: Bearer <token>.
X-Organization-Id
string
required
Active organization context.

Path parameters

roleId
string
required
The ID of the custom role to delete.

Response

success
boolean
required
true on successful deletion.
message
string
Confirmation message.
You cannot delete a role while any users are still assigned to it. Reassign those users to a different role before deleting. Protected roles (owner, admin, billing, member) can never be deleted.
curl --request DELETE \
  --url https://api.nyotaimara.com/v1/organizations/iam/roles/role_auditor \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Organization-Id: org_01j9kxyz'
{
  "success": true,
  "message": "Role 'auditor' deleted successfully."
}