Introduction to the Team API v2
Start with our v1 Core API docs for an introduction to the Kloudless API and more information on connecting user accounts and performing API requests.
Once an account is connected to your application, your application can perform API requests to the Team API endpoints listed below.
The Team endpoints are intended for use with Admin accounts connected to your Kloudless application. Admins can authenticate access to their entire organization’s data.
Requests can then be performed on behalf of each user of the organization
by setting the header X-Kloudless-As-User
to the appropriate
user’s ID. These IDs can be retrieved by listing all of the team’s users.
The following services require user impersonation via X-Kloudless-As-User
to access that user’s data via an admin account:
-
box
-
dropbox
-
gdrive
-
google_calendar
-
onedrivebiz
Other services such as s3
, sharepoint
and egnyte
do not require, nor
allow, users to be impersonated as all data is already available to admin
users.
The Team API has the following available object types:
-
user
-
group
-
membership
For all requests in this section, the account_id
in the URL must correspond
to an admin account that has authorized access to team data.
Users
User objects contain the following attributes:
-
id
(read-only) The ID of the user. Use this as the value of theX-Kloudless-As-User
header to perform API requests as this user. -
updated
(read-only) When the user was last updated. -
created
(read-only) When the user was created. -
name
The name of the user. -
name_details
(optional) A mapping of specific parts of the user’s name. -
email
User’s primary email address. -
emails
(optional) Alternate email addresses for the user. -
password
(write-only) The user’s password. -
type
Alwaysuser
. -
api
Alwaysteam
. -
ids
(read-only, optional) If there are multiple IDs returned by Kloudless to refer to this object in API responses, this attribute will be an object that maps all types of IDs that could be returned to their current values. Here are the possible types of IDs:default
: An ID that refers to this user account. Unique within the upstream service.team
: An ID that refers to this user within an admin account. Unique within the admin account.login
: Similar todefault
, but based on a property chosen by or assigned to the user instead, such as the user’s email address or username. This ID could change if the underlying value is updated. Usually based on the user’s email address. Unique within the upstream service.username
: The username of this user as specified in the upstream service. This ID could change if the underlying value is updated.impersonation
: (Dropbox specific) An ID that refers to a non-admin user’s team member ID, accessible by a Dropbox admin.admin-impersonation
: (Dropbox specific) An ID that refers to an admin user’s team member ID, accessible by a Dropbox admin.
-
id_type
(read-only, optional) Refers to the type ofid
value, for objects with multiple IDs. Only present if retrieving the object’s metadata would return anids
attribute with multiple values. -
external_id
(optional) A custom ID that can be set to identify the corresponding object in an external system, such as Active Directory. e.g. An Office 365 user’sonPremisesImmutableId
.
-
role
The role of the user within the organization. It can be one of the following values:admin
member
(default)external
-
role_name
The name of the role of the user within the organization. -
status
Current state of the user, one of:active
(default)suspended
inactive
-
username
The unique username. -
address
(optional) Combined address string. -
address_details
(optional) Mapping of address parts. -
addresses
(optional) Alternate addresses for the user. -
phone
(optional) User’s phone number. -
phones
(optional) Alternate phone numbers. -
organization
(optional) Name of the user’s organization. -
description
(optional) A description of the user. -
calendar_id
The ID of the user’s calendar, for use with the Kloudless Calendar API. This is currently supported for Google and Microsoft accounts. -
href
The absolute URL to get the object’s metadata. -
raw
(optional) Underlying object retrieved from the service.
List Users
Services currently supported are:
-
sharepoint
-
onedrivebiz
-
gdrive
-
egnyte
-
sharefile
Additional services supported in v1 are:
-
box
-
dropbox
-
google_calendar
-
s3
-
salesforce
The response contains the following information:
-
count
Number of users on this page. -
next_page
The value to provide in the request’spage
query parameter for the next page. This will benull
if there are no more pages. -
objects
List of User objects. -
type
Alwaysobject_list
. -
api
Alwaysteam
.
Example request:
curl -H 'Authorization: Bearer [TOKEN]' \
'https://api.kloudless.com/v2/accounts/123/team/users'
- Response
200
Toggle Headers
Content-Type: application/json
Body
{ "count": 1, "next_page": null, "page": "1", "objects": [ { "id": "u4806226", "id_type": "default", "name": "Test User", "email": "user@test.com", "calendar_id": "fdXNlckB0ZXN0LmNvbQ==", "type": "user", "api": "team", "ids": { "default": "u4806226", "team": "t3141592" }, "href": "https://api.kloudless.com/v2/accounts/123/team/users/u4806226" } ], "type": "object_list", "api": "team" }
Create User
Services currently supported are:
-
sharepoint
- Requires
email
,name
,password
, andusername
to be set.
- Requires
-
onedrivebiz
- See
sharepoint
.
- See
-
gdrive
- Requires
name
,email
, andpassword
to be set
- Requires
To create a new User, perform a POST request with a JSON object containing at
least the required fields described above. Any fields/data that are not unified
by the Kloudless API can be specified in the raw
object. Data in that object
takes precedence over fields in the unified request data.
Example request:
curl -XPOST -H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-H 'X-Kloudless-Raw-Data: true' \
'https://api.kloudless.com/v2/accounts/123/team/users' \
--data-binary '{
"name": "Test User",
"email": "user@test.com",
"raw": {
"object": {
"companyName": "kloudless",
"jobTitle": "developer"
}
}
}'
- RequestToggle
Headers
Content-Type: application/json
X-Kloudless-Raw-Data: trueBody
{ "name": "Test User", "email": "user@test.com", "raw": { "object": { ... "companyName": "kloudless", "jobTitle": "developer" ... } } }
- Response
201
Toggle Headers
Content-Type: application/json
X-Kloudless-Raw-Data: trueBody
{ "id": "u4806226", "id_type": "default", "name": "Test User", "email": "user@test.com", "calendar_id": "fdXNlckB0ZXN0LmNvbQ==", "type": "user", "api": "team", "ids": { "default": "u4806226", "team": "t3141592" }, "href": "https://api.kloudless.com/v2/accounts/123/team/users/u4806226" }
Retrieve a User
Services currently supported are:
-
sharepoint
-
onedrivebiz
-
gdrive
-
egnyte
-
sharefile
Additional services supported in v1 are:
-
box
-
dropbox
-
google_calendar
-
s3
-
salesforce
Example request:
curl -H 'Authorization: Bearer [TOKEN]' \
-H 'X-Kloudless-Raw-Data: true' \
'https://api.kloudless.com/v2/accounts/123/team/users/u4806226'
- Response
200
Toggle Headers
Content-Type: application/json
X-Kloudless-Raw-Data: trueBody
{ "id": "uNmVhODgwMTQtMTMwZi00ZWI3LWE4NzctZjhhM2U0OGVjMDg0OnVzZXIxQGRldi1vMzY1Lmtsb3VkbGVzcy5jb20=", "ids": { "default": "uNmVhODgwMTQtMTMwZi00ZWI3LWE4NzctZjhhM2U0OGVjMDg0OnVzZXIxQGRldi1vMzY1Lmtsb3VkbGVzcy5jb20=", "login": "udXNlcjFAZGV2LW8zNjUua2xvdWRsZXNzLmNvbQ==" }, "id_type": "default", "external_id": null, "type": "user", "api": "team", "modified": null, "created": null, "email": "user1@test.com", "status": "active", "username": "user1@test.com", "name": "user1 test", "name_details": { "given": "user1", "full": "user1 test", "family": "test" }, "address": null, "address_details": { "country": null, "region": null, "code": null, "street": null, "locality": null }, "phone": null, "organization": null, "role": "member", "role_name": "Member", "emails": [], "phones": [], "calendar_id": "fdXNlckB0ZXN0LmNvbQ==", "href": "https://api.kloudless.com/v2/accounts/123/team/users/uNmVhODgwMTQtMTMwZi00ZWI3LWE4NzctZjhhM2U0OGVjMDg0OnVzZXIxQGRldi1vMzY1Lmtsb3VkbGVzcy5jb20=" "raw": { "object":{ ... "companyName": "kloudless", "jobTitle": "developer" ... } } }
List a User's Group Memberships
/accounts/{account_id}/team/users/{user_id}/memberships{?page_size,page}
Services currently supported are:
-
sharepoint
-
onedrivebiz
-
gdrive
-
egnyte
-
sharefile
Additional services supported in v1 are:
-
box
-
dropbox
-
google_calendar
-
s3
-
salesforce
The response contains the following information:
-
count
Number of objects on this page. -
next_page
The value to provide in the request’spage
query parameter for the next page. This will benull
if there are no more pages. -
objects
List of Membership objects for the groups that the user is a member of. -
type
Alwaysobject_list
. -
api
Alwaysteam
.
Example request:
curl -H 'Authorization: Bearer [TOKEN]' \
'https://api.kloudless.com/v2/accounts/123/team/users/u4806226/memberships'
- Response
200
Toggle Headers
Content-Type: application/json
Body
{ "count": 1, "next_page": null, "page": "1", "objects": [ { "id": "mbWVycAo=", "type": "membership", "role": "member", "api": "team", "group": { "id": "g982734", "name": "Test Group", "type": "group", "api": "team", }, "member": { "id": "uZGVycEBtZXJwLmNvbQo=", "id_type": "default", "name": "Jane Doe", "email": "user@test.com", "type": "user", "api": "team", "ids" { "default": "uZGVycEBtZXJwLmNvbQo=", "team": "t3141592" } } } ], "type": "object_list", "api": "team", }
Update User
Services currently supported are:
-
sharepoint
-
onedrivebiz
-
gdrive
-
egnyte
-
sharefile
To update a user, perform a PATCH request to the desired user_id
with the
attributes that you would like to update. Any of the non-read-only attributes
can be specified in the object.
Example request:
curl -L -H 'Authorization: Bearer [TOKEN]' \
-XPATCH \
'https://api.kloudless.com/v2/accounts/34/team/users/uZGVycEBtZXJwLmNvbQo=' \
-H "Content-Type: application/json"
--data-binary '{"name": "Jane Doe"}'
- Response
200
Toggle Headers
Content-Type: application/json
Body
{ "id": "uZGVycEBtZXJwLmNvbQo=", "id_type": "default", "name": "Jane Doe", "email": "user@test.com", "calendar_id": "fdXNlckB0ZXN0LmNvbQ==", "type": "user", "api": "team", "ids": { "default": "uZGVycEBtZXJwLmNvbQo=", "team": "t3141592" }, "href": "https://api.kloudless.com/v2/accounts/123/team/users/uZGVycEBtZXJwLmNvbQo=" }
Delete a User
Example request:
curl -L -H 'Authorization: Bearer [TOKEN]' \
-XDELETE \
'https://api.kloudless.com/v2/accounts/34/team/users/uZGVycEBtZXJwLmNvbQo='
- Response
204
Group
Group objects represent collections of users and groups. They have the following attributes:
-
id
(read-only) The ID of the group object, used to reference it in other requests. -
type
(read-only) Alwaysgroup
. -
api
(read-only) Alwaysteam
. -
modified
(read-only) When the group was last modified. -
created
(read-only) When the group was created. -
external_id
(optional) A custom ID that can be set to identify the corresponding object in an external system, such as Active Directory. -
name
The group’s name. -
email
The group email address. -
description
(optional) A description of the group. -
raw
(optional) Underlying object retrieved from the service. -
ids
(read-only, optional) If there are multiple IDs returned by Kloudless to refer to this object in API responses, this attribute will be an object that maps all types of IDs that could be returned to their current values. Here are the possible types of IDs:default
: An ID that refers to this group. Unique within the upstream service.name
: The name of the group as defined in the upstream service. This ID may change if the underlying value changes.
-
id_type
(read-only, optional) Refers to the type ofid
value, for objects with multiple IDs. Only present if retrieving the object’s metadata would return anids
attribute with multiple values. -
href
The absolute URL to get the object’s metadata.
List Groups
Services currently supported are:
-
sharepoint
-
onedrivebiz
-
gdrive
-
egnyte
-
sharefile
Additional services supported in v1 are:
-
box
-
dropbox
-
google_calendar
-
s3
-
salesforce
The response contains the following information:
-
count
Number of objects on this page. -
next_page
The value to provide in the request’spage
query parameter for the next page. This will benull
if there are no more pages. -
objects
List of [Group] objects.
Example request:
curl -H 'Authorization: Bearer [TOKEN]' \
'https://api.kloudless.com/v2/accounts/123/team/groups'
- Response
200
Toggle Headers
Content-Type: application/json
Body
{ "count": 1, "next_page": null, "page": "1", "objects": [ { "id": "g982734", "type": "group", "api": "team", "modified": null, "created": "2017-11-02T11:05:49Z", "name": "Test Group", "email": "testgroup@dev-o365.kloudless.com", "description": "33221", "href": "https://api.kloudless.com/v2/accounts/123/team/groups/g982734" "raw": { "object": { ... "mailNickname": "testgroup", ... }, "id": "7a814f9a-42fd-4036-914e-4e92358fabc9" } } ], "type": "object_list", "api": "team" }
Create Group
-
sharepoint
- Requires
email
andname
to be set. - Creation of directory roles is not supported.
- Requires
-
onedrivebiz
- See
sharepoint
.
- See
Example request:
curl -XPOST -H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-H 'X-Kloudless-Raw-Data: true' \
'https://api.kloudless.com/v2/accounts/123/team/groups/' \
--data-binary '{
"name": "Test Group",
"raw": {
"object": {
"mailNickname": "testgroup"
}
}
}'
- RequestToggle
Headers
Content-Type: application/json
X-Kloudless-Raw-Data: trueBody
{ "name": "Test Group", "raw": { "object": { "mailNickname": "testgroup" } } }
- Response
201
Toggle Headers
Content-Type: application/json
X-Kloudless-Raw-Data: trueBody
{ "id": "g982734", "type": "group", "api": "team", "modified": null, "created": "2017-11-02T11:05:49Z", "name": "Test Group", "email": "testgroup@dev-o365.kloudless.com", "description": "33221", "href": "https://api.kloudless.com/v2/accounts/123/team/groups/g982734" "raw": { "object": { ... "mailNickname": "testgroup", ... }, "id": "7a814f9a-42fd-4036-914e-4e92358fabc9" } }
Retrieve a Group
Services currently supported are:
-
sharepoint
-
onedrivebiz
-
gdrive
-
egnyte
-
sharefile
Additional services supported in v1 are:
-
box
-
dropbox
-
google_calendar
-
s3
-
salesforce
Example request:
curl -H 'Authorization: Bearer [TOKEN]' \
-H 'X-Kloudless-Raw-Data: true' \
'https://api.kloudless.com/v2/accounts/123/team/groups/g982734'
- Response
200
Toggle Headers
Content-Type: application/json
X-Kloudless-Raw-Data: trueBody
{ "id": "g982734", "type": "group", "api": "team", "modified": null, "created": "2017-11-02T11:05:49Z", "name": "Test Group", "email": "testgroup@dev-o365.kloudless.com", "description": "33221", "href": "https://api.kloudless.com/v2/accounts/123/team/groups/g982734" "raw": { "object": { ... "mailNickname": "testgroup", ... }, "id": "7a814f9a-42fd-4036-914e-4e92358fabc9" } }
List a Group's Members
Services currently supported are:
-
sharepoint
-
onedrivebiz
-
gdrive
-
egnyte
-
sharefile
Additional services supported in v1 are:
-
box
-
dropbox
-
google_calendar
-
s3
-
salesforce
The response contains the following information:
-
count
Number of objects on this page. -
next_page
The value to provide in the request’spage
query parameter for the next page. This will benull
if there are no more pages. -
objects
List of Membership objects representing the group members.
Example request:
curl -H 'Authorization: Bearer [TOKEN]' \
'https://api.kloudless.com/v2/accounts/123/team/groups/g982734/members'
- Response
200
Toggle Headers
Content-Type: application/json
Body
{ "count": 1, "next_page": null, "page": "1", "objects": [ { "id": "mbWVycAo=", "type": "membership", "role": "member", "api": "team", "group": { "id": "g982734", "name": "Test Group", "type": "group", "api": "team", }, "member": { "id": "uZGVycEBtZXJwLmNvbQo=", "id_type": "default", "name": "Jane Doe", "email": "user@test.com", "type": "user", "api": "team", "ids" { "default": "uZGVycEBtZXJwLmNvbQo=", "team": "t3141592" } } } ], "type": "object_list", "api": "team", }
Update Group
Services currently supported are:
-
sharepoint
-
onedrivebiz
-
gdrive
To update a group, perform a PATCH request to the desired group_id
with the
attributes you would like to update. Any of the non-read-only attributes can
be specified in the object.
Example request:
curl -XPATCH -H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
'https://api.kloudless.com/v2/accounts/123/team/groups/g982734' \
--data-binary '{"name": "Other Group"}'
Delete a Group
Example request:
curl -XDELETE \
-H 'Authorization: Bearer [TOKEN]' \
'https://api.kloudless.com/v2/accounts/123/team/groups/g982734'
- Response
204
Membership
Membership objects represent the membership of a user or group in another group. They have the following attributes:
-
id
(read-only) The ID of the membership object, used to reference it in other requests. -
type
(read-only) Alwaysmembership
. -
api
(read-only) Alwaysteam
. -
member
(non-editable) The object that is a member of the Group, either a User or a Group. -
group
(non-editable) The group themember
is a part of. -
role
The role of themember
in thegroup
, default:member
.
Services currently supported are:
-
gdrive
-
onedrivebiz
-
sharepoint
Create Membership
To create a new Membership, performa a POST request with a json object
containing the member
, target group
, and the role
.
Example request:
curl -XPOST -H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json'
'https://api.kloudless.com/v2/accounts/123/team/memberships' \
--data-binary '{
"role": "member",
"group": {"id": "g982734", "type": "group"},
"member": {"id": "uZGVycEBtZXJwLmNvbQo", "type": "user"}
}'
- RequestToggle
Headers
Content-Type: application/json
Body
{ "role": "member", "group": { "id": "g982734", "type": "group" }, "member": { "id": "uZGVycEBtZXJwLmNvbQo", "type": "user" } }
- Response
201
Toggle Headers
Content-Type: application/json
Body
{ "id": "mbWVycAo=", "type": "membership", "role": "member", "api": "team", "group": { "id": "g982734", "name": "Test Group", "type": "group", "api": "team", }, "member": { "id": "uZGVycEBtZXJwLmNvbQo=", "id_type": "default", "name": "Jane Doe", "email": "user@test.com", "type": "user", "api": "team", "ids" { "default": "uZGVycEBtZXJwLmNvbQo=", "team": "t3141592" } } }
Update Membership
To update a membership, a PATCH request can be performed. Any writable attributes can be included in the request body.
Example request:
curl -XPATCH -H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json'
'https://api.kloudless.com/v2/accounts/123/team/memberships/mbWVycAo=' \
--data-binary '{ "role": "admin" }'
- RequestToggle
Headers
Content-Type: application/json
Body
{ "role": "admin", }
- Response
200
Toggle Headers
Content-Type: application/json
Body
{ "id": "mbWVycAo=", "type": "membership", "role": "admin", "api": "team", "group": { "id": "g982734", "name": "Test Group", "type": "group", "api": "team", }, "member": { "id": "uZGVycEBtZXJwLmNvbQo=", "id_type": "default", "name": "Jane Doe", "email": "user@test.com", "type": "user", "api": "team", "ids" { "default": "uZGVycEBtZXJwLmNvbQo=", "team": "t3141592" } } }
Delete Membership
Example request:
curl -XDELETE -H 'Authorization: Bearer [TOKEN]' \
'https://api.kloudless.com/v2/accounts/123/team/memberships/mbWVycAo='
- Response
204