Skip to content

Users

Manage user access in the Amili system. Users are associated with Accounts and can be granted access to all Creditors within that Account using the account_admin access group. Users can also be granted more specific access to individual Creditors through other access groups.

User endpoints

See Account for managing the business entities users belong to. See swagger Application for list of available applications. See swagger Access-Group for documentation and and management of access groups.

Authentication Method

The recommended authentication method for users is OAuth authentication (Microsoft, Google, etc.):

  • email_oauth (string, required) - OAuth email address
  • oauth_type (string, required) - OAuth provider type (e.g., "microsoft", "google")*
  • oauth_subscriber (string, optional) - OAuth subscriber ID for multi-tenant scenarios

Example Request

Below is an example of creating a user with OAuth authentication. Other operations follow similar request/response patterns with the same data structure.

URL: POST /users

Headers:

x-api-key: {your_access_token}
Content-Type: application/json

Request Body:

json
{
  "account": "674dbeaf08847b9501cc9132",
  "name": "Jane Doe",
  "email_data": {
    "email": "jane.doe@domain.se"
  },
  "oauth_type": "microsoft",
  "email_oauth": "jane.doe@domain.se",
  "data_access": [
    {
      "access_group": "60e7fdefc90dc3e2ddd6c7ad"
    }
  ],
  "is_enabled": true,
  "applications": [
    {
      "application": "60e7fdefc90dc3e2ddd6c7af"
    },
    {
      "application": "60e7fdefc90dc3e2ddd6c7b0"
    }
  ]
}

Response Code: 201 Created

Response Body:

json
{
  "_updated": "Fri, 29 Aug 2025 07:45:25 GMT",
  "_created": "Fri, 29 Aug 2025 07:45:25 GMT",
  "_etag": "8be4d5fc86d77d226b0f83f8593de42334a0a192",
  "_id": "68678ed98d8dc95ece127944",
  "_status": "OK"
}

Parameters

Request Body Properties

Note: One of account, partner, or solicitor is required.

PropertyTypeRequiredDescription
accountstringYes (or partner/solicitor)Account ID - for account users
partnerstringYes (or account/solicitor)Partner ID - for partner users
solicitorobjectYes (or account/partner)Solicitor details - for solicitor users (see Solicitor Properties below)
namestringYesUser's full name
descriptionstringNoUser description
email_dataobjectNoEmail information (see Email Data Properties below)
mobile_number_dataobjectNoMobile number information (see Mobile Number Data Properties below)
oauth_typestringYes (for OAuth)OAuth authentication type (e.g. "microsoft", "google")*
email_oauthstringYes (for OAuth)OAuth email address
oauth_subscriberstringNoOAuth subscriber ID (requires oauth_type and email_oauth)
data_accessarrayNoList of access group assignments
is_enabledbooleanNoWhether user is active (default: true)
applicationsarrayNoList of application assignments
log_invoice_registrationsbooleanNoLog invoice registrations (default: false)
log_case_registrationsbooleanNoLog case registrations (default: false)
log_creditor_paymentsbooleanNoLog creditor payments (default: false)
log_creditor_cancellationsbooleanNoLog creditor cancellations (default: false)
log_creditor_creditingsbooleanNoLog creditor creditings (default: false)
system_userbooleanNoWhether system user (default: false)
managed_by_external_systembooleanNoWhether user is managed by external system (default: false)
external_idstringNoExternal system identifier
main_unitstringNoReference to user unit (ObjectId)
ui_structuresarrayNoUI structure references (list of objects with ui_structure)
managerstringNoReference to manager user (ObjectId)

Email Data Properties

PropertyTypeRequiredDescription
emailstringYesEmail address

Mobile Number Data Properties

PropertyTypeRequiredDescription
mobile_numberstringYesMobile number

Solicitor Properties

PropertyTypeRequiredDescription
officestringYesSolicitor office ID (ObjectId)
functionstringNoSolicitor function*
external_consultbooleanNoWhether external consultant (default: false)
positionstringNoPosition title
teamstringNoTeam ID (ObjectId)

Data Access Properties

Data access entries can include temporal restrictions using from and until fields.

PropertyTypeRequiredDescription
access_groupstringYesAccess group ID**
fromstringNoDate from which access is valid (RFC 1123 format)
untilstringNoDate until which access is valid (RFC 1123 format)
granted_datestringNoAccess grant date (readonly, cascade updated)
access_group_namestringNoAccess group name (readonly, cascade updated)
access_group_account_namestringNoAssociated account name (readonly, cascade updated)
access_group_creditor_namestringNoAssociated creditor name (readonly, cascade updated)
access_group_partner_namestringNoAssociated partner name (readonly, cascade updated)
access_group_typestringNoAccess group type (e.g. "admin")* (readonly, cascade updated)

Application Properties

PropertyTypeRequiredDescription
applicationstringYesApplication ID***
application_namestringNoApplication name (e.g. "ada_ui")*

Response Properties

PropertyTypeRequiredDescription
_idstringYesUnique identifier for the user
_createdstringYesCreation timestamp
_updatedstringYesLast update timestamp
_etagstringYesEntity tag for concurrency control
_statusstringYesRequest status (e.g. "OK")*

Validation Rules

User Type Requirement:

  • One of account, partner, or solicitor is required (any_of_required)
  • These fields are mutually exclusive - provide only one

OAuth Authentication:

  • oauth_type and email_oauth are required for OAuth authentication
  • oauth_subscriber is optional and requires both oauth_type and email_oauth to be set

Uniqueness Constraints: The following key pairs must be unique:

  • (partner, name, email_oauth) - for partner users with OAuth
  • (account, name, email_oauth) - for account users with OAuth

Data Access Temporal Restrictions:

  • from and until fields in data_access entries allow time-bound access
  • Both fields use RFC 1123 datetime format
  • Access is valid from from date (inclusive) to until date (exclusive)

Cascade Updates: Several fields in data_access are automatically updated when related documents change:

  • granted_date - Set when access is granted
  • access_group_name - Updated from access_group.name
  • access_group_account_name - Updated from access_group.account.name
  • access_group_creditor_name - Updated from access_group.creditor.name
  • access_group_partner_name - Updated from access_group.partner.name
  • access_group_type - Updated from access_group.type

*) For complete list of values and details, please see User **) For available access groups and details, please see Access Group ***) For available applications and details, please see Application