GET /api/users
Get users list

Returns the list of authenticated user’s current company users.

Supported Formats

json

Examples

[
  {
    "id":3,
    "name":"Approver 2",
    "email":"approver2@burucorp.com",
    "last_sign_in_at":"2017-10-31T18:50:10.714Z",
    "sign_in_count":1,
    "locale":"fi",
    "role":"Employee",
    "roles":["employee","accountant"],
    "state":"accepted",
    "memberships":[
      {
        "id":3,
        "user_id":3,
        "company_id":1,
        "state":"accepted",
        "roles":["employee","accountant"],
        "uuid":"81eed846-2297-43a8-a0d5-3c1134b16ee9",
        "created_at":"2017-09-06T11:59:26.012Z",
        "updated_at":"2017-12-15T16:38:48.262Z"
      }
    ],
    "ssn":"160583-1664",
    "email_is_confirmed":true
  }
] 

GET /api/users/extended_index
Get users' details list

Returns the list of authenticated user’s current company users.

Each user in the list includes the same fields as each user in GET /api/users list + the following additional fields:

  • user’s approvers list

  • user’s IBAN

Supported Formats

json

POST /api/users
Add new user

Add new user and set his current company settings

Params

Param name Description
user
required

User params

Validations:

  • Must be a Hash

user[name]
required

User full name

Validations:

  • Must be String

user[email]
required

Validations:

  • Must be String

user[password]
optional , nil allowed

Validations:

  • Must be String

user[password_confirmation]
optional , nil allowed

Required if “password” param is supplied

Validations:

  • Must be String

user[ssn]
optional , nil allowed

User’s Social Security Number

Validations:

  • Must be String

user[iban]
optional , nil allowed

IBAN

Validations:

  • Must be String

user[bic]
optional , nil allowed

BIC

Validations:

  • Must be String

user[locale]
optional , nil allowed

Validations:

  • Must be one of: en, fi, sv.

user[send_reminder_emails]
optional , nil allowed

Defaults to true

Validations:

  • Must be one of: true, false.

user[show_optional_fields]
optional , nil allowed

Defaults to true

Validations:

  • Must be one of: true, false.

user[settings]
optional , nil allowed

Validations:

  • Must be a Hash

user[settings][easy_expenses]
optional , nil allowed

Whether to activate “Easy Expenses” method. Defaults to false

Validations:

  • Must be one of: true, false.

user[settings][default_cost_centers]
optional , nil allowed

Validations:

  • Must be Hash

user[settings][default_asset_account_id]
optional , nil allowed

Validations:

  • Must be Integer

user[settings][default_expense_account_id]
optional , nil allowed

Validations:

  • Must be Integer

user[settings][mileage_vehicle_category_id]
optional , nil allowed

Validations:

  • Must be Integer

user[settings][allowance_country_category_id]
optional , nil allowed

Validations:

  • Must be Integer

user[settings][netsuite]
optional , nil allowed

NetSuite settings in free form hash

Validations:

  • Must be Hash

user[approvers_attributes]
optional , nil allowed

Add/Remove user approvers. Current user should have “manager” role to edit approvers

Validations:

  • Must be an Array of nested elements

user[approvers_attributes][id]
optional , nil allowed

User approver id, required if user approver already exists. If it’s not supplied, new user approver will be added

Validations:

  • Must be Integer

user[approvers_attributes][approver_id]
required

Approver id

Validations:

  • Must be Integer

user[approvers_attributes][operator]
required

Operator specifying approver process logic

Validations:

  • Must be one of: then, and, or.

user[approvers_attributes][_destroy]
optional , nil allowed

Pass “true” here to delete an existing approver

Validations:

  • Must be one of: true, false.

skip_notification
optional

Skip sending invitation notification. Defaults to “false”

Validations:

  • Must be one of: true, false.


PUT /api/users/:id
Edit existing user

Edit user and his current company settings

Params

Param name Description
user
required

User params

Validations:

  • Must be a Hash

user[name]
optional

User full name

Validations:

  • Must be String

user[email]
optional

Validations:

  • Must be String

user[password]
optional , nil allowed

Validations:

  • Must be String

user[password_confirmation]
optional , nil allowed

Required if “password” param is supplied

Validations:

  • Must be String

user[ssn]
optional , nil allowed

User’s Social Security Number

Validations:

  • Must be String

user[iban]
optional , nil allowed

IBAN

Validations:

  • Must be String

user[bic]
optional , nil allowed

BIC

Validations:

  • Must be String

user[locale]
optional , nil allowed

Validations:

  • Must be one of: en, fi, sv.

user[send_reminder_emails]
optional , nil allowed

Defaults to true

Validations:

  • Must be one of: true, false.

user[show_optional_fields]
optional , nil allowed

Defaults to true

Validations:

  • Must be one of: true, false.

user[settings]
optional , nil allowed

Validations:

  • Must be a Hash

user[settings][easy_expenses]
optional , nil allowed

Whether to activate “Easy Expenses” method. Defaults to false

Validations:

  • Must be one of: true, false.

user[settings][default_cost_centers]
optional , nil allowed

Validations:

  • Must be Hash

user[settings][default_asset_account_id]
optional , nil allowed

Validations:

  • Must be Integer

user[settings][default_expense_account_id]
optional , nil allowed

Validations:

  • Must be Integer

user[settings][mileage_vehicle_category_id]
optional , nil allowed

Validations:

  • Must be Integer

user[settings][allowance_country_category_id]
optional , nil allowed

Validations:

  • Must be Integer

user[settings][netsuite]
optional , nil allowed

NetSuite settings in free form hash

Validations:

  • Must be Hash

user[approvers_attributes]
optional , nil allowed

Add/Remove user approvers. Current user should have “manager” role to edit approvers

Validations:

  • Must be an Array of nested elements

user[approvers_attributes][id]
optional , nil allowed

User approver id, required if user approver already exists. If it’s not supplied, new user approver will be added

Validations:

  • Must be Integer

user[approvers_attributes][approver_id]
optional

Approver id

Validations:

  • Must be Integer

user[approvers_attributes][operator]
optional

Operator specifying approver process logic

Validations:

  • Must be one of: then, and, or.

user[approvers_attributes][_destroy]
optional , nil allowed

Pass “true” here to delete an existing approver

Validations:

  • Must be one of: true, false.


GET /api/users/:id
Get user details by id

Returns user fields and a few nested entities

Supported Formats

json

Examples

{
  "id":3,
  "name":"Manager AltCorp",
  "email":"manager@altcorp.com",
  "role":"Manager",
  "ssn":"0000000-0",
  "last_sign_in_at":"2016-03-16T10:01:54.163Z",
  "sign_in_count":3,
  "roles":["manager"],
  "forward_email_address":"71882469-5381-456d-b71b-80825c1320ac@app.bezala.com",
  "send_reminder_emails":true,
  "iban":null,
  "bic":null,
  "locale":"en",
  "state":"accepted",
  "memberships":1,
  "show_optional_fields":true,
  "settings": {
    "id":31,
    "user_id":3,
    "company_id":1,
    "default_asset_account_id":null,
    "default_expense_account_id":60,
    "default_cost_centers":null,
    "mileage_vehicle_category_id":null,
    "allowance_country_category_id":null
  },
  "companies_to_switch": [
    {"id":1,"name":"Blacorp"}
  ],
  "company": {"id":2,"name":"Alternative Corp"},
  "approvers": [1]
}
    

DELETE /api/users/:id
Delete user from the current company by id

Removes user from the company by deleting his company membership. The user account stays intact and can be reinvited later. All of the user’s transactions are kept intact.

Supported Formats

json

PUT /api/users/:id/change_company/:company_id
Change user's current company id

Changes user current company to one of the companies available for this user