Search the docs
Menu
Updated Edit on GitHub

Server API: organizations

Copy as Markdown

These routes are on the server API, port 21114 (21121 in Docker). They take an API key in X-API-Key or a sign-in token; see The HTTP API.

Organizations on the server API: their users and members, invitations, devices, settings, shared address book, saved connect passwords and policies, and the sign-in of an organization's users.

GET /api/org

List organizations.

Super admins see every organization, anyone else the ones they are a member of and the one of their organization sign-in.

On the server API, port 21114.

200: Done (application/json)

Field Type Required
organizations array of Organization yes
Error When
401 No credential, or one that is not valid

POST /api/org

Make an organization.

On the server API, port 21114. Needs org.create.

Request body, application/json:

Field Type Required What it is
name string yes Trimmed, 1 to 120 characters; at most 120 characters
slug string yes 3 to 64 lowercase letters, digits and hyphens, not starting or ending with a hyphen; taken in lower case
logo_url string An http or https address with a host, or empty
settings string A JSON text to keep with the organization, "{}" when left out

201: Created (application/json)

Organization.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The credential's role lacks the permission
409 The slug is in use

POST /api/org/login

Sign in as a user of an organization.

Counts against the sign-in limit per address. The token is a JWT, valid as long as the server's sign-in tokens (JWT_EXPIRY_HOURS). Sent as Authorization: Bearer, it reads the organization and its shared address book; the routes about users, invitations, devices, settings, saved passwords and policies refuse it.

On the server API, port 21114.

Request body, application/json:

org_id or org_slug, with the username and password.

Field Type Required What it is
org_id string The organization's id; org_slug is not read with it
org_slug string
username string yes
password string yes

200: Done (application/json)

Field Type Required
token string yes
user OrganizationUser yes
org_id string yes
type "org_user" yes
Error When
400 The request is not valid
401 The username or password is wrong ("invalid credentials")
404 No organization has this slug
429 Too many sign-in attempts from this address

GET /api/org/{id}

Show one organization.

Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in may read its own organization.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

Organization.

Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 There is no such item

PUT /api/org/{id}

Change an organization.

Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.edit.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

Request body, application/json:

The fields to change. A field left out stays as it is.

Field Type What it is
name string Trimmed, 1 to 120 characters; at most 120 characters
slug string 3 to 64 lowercase letters, digits and hyphens; taken in lower case
logo_url string An http or https address with a host, or empty
settings string A JSON text to keep with the organization

200: Done (application/json)

Organization.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 There is no such item
409 The slug is in use

DELETE /api/org/{id}

Delete an organization.

Deletes the organization with its users, devices, invitations, settings, address book and saved device passwords. Only the permission is checked, not membership.

On the server API, port 21114. Needs org.delete.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

204: Deleted

Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 There is no such item

GET /api/org/{id}/address-book

Show an organization's shared address book.

Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in may read the address book of its organization.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

Field Type Required What it is
data string yes The address book as JSON text, "{}" when none is stored
enabled boolean yes Whether the organization shares the address book; true unless it was turned off
Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

PUT /api/org/{id}/address-book

Replace an organization's shared address book.

Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.edit.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

Request body, application/json:

Field Type What it is
data object or string The address book, as an object or as JSON text. The password and hash of every peer are removed before it is stored; at most 512 kB. Left out or null keeps the stored one
enabled boolean Turns sharing on or off

200: Done (application/json)

OrganizationOk.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
413 The address book is larger than 512 kB

GET /api/org/{id}/available-users

List console accounts that are not members of an organization.

Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_users.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

Field Type Required
users array of OrganizationAvailableAccount yes
Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

GET /api/org/{id}/devices

List an organization's devices.

Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in is refused.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

Field Type Required
devices array of OrganizationDevice yes
Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

POST /api/org/{id}/devices

Add a device to an organization.

A device in the organization already gets the new details. The server checks no device scope beyond membership. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

Request body, application/json:

Field Type Required What it is
device_id string yes The id of a device the server has
assigned_user_id string
department string
location string
building string
tags string Text, such as "office,ground-floor"

201: Added (application/json)

OrganizationDevice.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 No device has this id on the server

DELETE /api/org/{id}/devices/{did}

Take a device out of an organization.

Answers 204 also for a device that is not in the organization. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_devices.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
did path string yes The device's id

204: Done

Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

GET /api/org/{id}/invitations

List an organization's invitations.

All invitations, used and expired ones too, by the end of their validity, latest first, without their codes. Besides super admins and global admins only an owner or admin of the organization may read them. An organization sign-in is refused.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

Field Type Required
invitations array of OrganizationInvitation yes
Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

DELETE /api/org/{id}/invitations/{invId}

Withdraw an invitation to an organization.

Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_users.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
invId path string yes The invitation's id (a UUID)

204: Withdrawn

Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 The organization has no such invitation
409 The invitation was used

POST /api/org/{id}/invite

Invite someone to an organization.

Makes an invitation with the role user. Its code is in the answer this once: the server keeps only its hash. The person redeems it on the console's /invite page. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_users.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

Request body, application/json:

Field Type What it is
email string (email) One address, or empty; trimmed
expires_in_hours integer default 72, at least 1, at most 720

201: Created (application/json)

OrganizationInvitation.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 There is no such item

POST /api/org/{id}/members

Link a console account to an organization as a member.

The membership gets the role user and the account's username. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_users.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

Request body, application/json:

Field Type Required What it is
user_id integer yes The console account's id; at least 1

201: Created (application/json)

OrganizationUser.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 There is no such organization or account
409 The account is a member already, or the organization has a user with its username

DELETE /api/org/{id}/members/{userId}

Take a console account out of an organization.

Besides super admins and global admins only an owner or admin of the organization may do this. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_users.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
userId path integer yes The console account's id, a whole number; at least 1

204: Done

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 The account is not a member of the organization

GET /api/org/{id}/peer-credentials

List the devices of an organization with a saved connect password.

The passwords are not in the answer. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in is refused.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

Field Type Required
credentials array of OrganizationPeerCredential yes
Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

PUT /api/org/{id}/peer-credentials/{peerId}

Save the connect password of a device in an organization.

The password is stored sealed. NeoDesk clients of the organization get it with the shared address book; no answer holds it. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.edit.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
peerId path string yes The device's id: 6 to 16 letters, digits, _ or -

Request body, application/json:

Field Type Required What it is
password string yes Trimmed, 1 to 128 bytes; at most 128 characters

200: Done (application/json)

Field Type Required
status "ok" yes
password_set true yes
Error When
400 The device id or the password is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
503 The server has no key to seal passwords with ("peer credential vault not configured")

DELETE /api/org/{id}/peer-credentials/{peerId}

Delete the saved connect password of a device in an organization.

Answers ok also when no password was saved. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.edit.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
peerId path string yes The device's id: 6 to 16 letters, digits, _ or -

200: Done (application/json)

OrganizationOk.

Error When
400 The device id is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

GET /api/org/{id}/policy

Show an organization's policies.

Every group is there, {} when the organization sets none of it. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in is refused.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

OrgPolicies.

Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

GET /api/org/{id}/policy/audit

List the changes to an organization's policies.

Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in is refused.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

OrgPolicyAudit.

Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

GET /api/org/{id}/policy/effective/{deviceId}

Show the policies of an organization for one device.

The groups the organization stored, as they are. The handler neither checks that the device belongs to the organization nor fills in defaults; GET /api/peers/{id}/policy does both. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in is refused.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
deviceId path string yes The device's id

200: Done (application/json)

OrgPolicyEffective.

Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

PUT /api/org/{id}/policy/{category}

Set one policy group of an organization.

Replaces the group with the settings in the body. A setting the group doesn't have, or a value of the wrong kind or out of range, is refused with a reason that names it. {} clears the group. The change goes to the audit log as org_policy_changed. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.edit.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
category path string, one of connection, features, security, network, update yes The policy group

Request body, application/json:

The settings of the group the path names

OrgPolicyConnection or OrgPolicyFeatures or OrgPolicySecurity or OrgPolicyNetwork or OrgPolicyUpdate.

200: Done (application/json)

OrgPolicySaved.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 There is no such item

GET /api/org/{id}/settings

List an organization's settings.

The stored settings, the policy groups among them. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in is refused.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

Field Type Required
settings array of OrganizationSetting yes
Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

PUT /api/org/{id}/settings

Store one setting of an organization.

Nothing checks the key against a list, nor that the organization exists. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.edit.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

Request body, application/json:

Field Type Required What it is
key string yes Not one of the retired connection_policy, allow_file_transfer, allow_clipboard and max_session_duration_min
value string

200: Done (application/json)

OrganizationOk.

Error When
400 No key, or a retired key ("this setting is no longer stored")
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

GET /api/org/{id}/users

List an organization's users.

The sign-ins of the organization and the console accounts linked to it, by username. A member whose organization role is user sees only itself. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization"). An organization sign-in is refused.

On the server API, port 21114.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

200: Done (application/json)

Field Type Required
users array of OrganizationUser yes
Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

POST /api/org/{id}/users

Make a user of an organization (NeoDesk Desktop sign-in).

The user gets the role user. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_users.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)

Request body, application/json:

Field Type Required What it is
username string yes 3 to 64 characters: letters, digits and . _ @ -
password string yes 8 to 128 characters; at least 8 characters, at most 128 characters
display_name string
email string

201: Created (application/json)

OrganizationUser.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 There is no such item
409 The organization has a user with this username

PUT /api/org/{id}/users/{uid}

Change a user of an organization.

The user is found by its id alone; the handler does not check that it belongs to the organization in the path. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_users.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
uid path string yes The user's id (a UUID)

Request body, application/json:

The fields to change. A field left out stays as it is.

Field Type What it is
display_name string
email string
password string 8 to 128 characters; empty keeps the password; at most 128 characters

200: Done (application/json)

OrganizationUser.

Error When
400 The request is not valid
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization
404 There is no user with this id

DELETE /api/org/{id}/users/{uid}

Delete a user of an organization.

Answers 204 also for an id no user has. The user is deleted by its id alone, without a check that it belongs to the organization in the path. Super admins and global admins reach every organization; anyone else only one they are a member of, or the organization of their organization sign-in (403 "Not a member of this organization").

On the server API, port 21114. Needs org.manage_users.

Parameter In Type Required What it is
id path string yes The organization's id (a UUID)
uid path string yes The user's id (a UUID)

204: Deleted

Error When
401 No credential, or one that is not valid
403 The role lacks the permission, or the caller is not a member of the organization

Type to search pages, sections, commands and settings.