Access the Google Workspace Admin SDK with managed OAuth authentication. Read and manage users, groups, organizational units, roles, and domain settings for Google Workspace. This is high-impact administrative access — connect only with least-privilege OAuth scopes and revoke the connection when administrative work is complete.
Reference
List Users
GET /google-workspace-admin/admin/directory/v1/users?customer=my_customer&maxResults=100Query parameters:
customer- Customer ID ormy_customerfor your domain (required)domain- Filter by specific domainmaxResults- Maximum results per page (1-500, default 100)orderBy- Sort byemail,familyName, orgivenNamequery- Search query (e.g.,email:john*,name:John*)pageToken- Token for pagination
Example:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/google-workspace-admin/admin/directory/v1/users?customer=my_customer&query=email:john*')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFResponse:
{
"kind": "admin#directory#users",
"users": [
{
"id": "123456789",
"primaryEmail": "john@example.com",
"name": {
"givenName": "John",
"familyName": "Doe",
"fullName": "John Doe"
},
"isAdmin": false,
"isDelegatedAdmin": false,
"suspended": false,
"creationTime": "2024-01-15T10:30:00.000Z",
"lastLoginTime": "2025-02-01T08:00:00.000Z",
"orgUnitPath": "/Sales"
}
],
"nextPageToken": "..."
}Get User
GET /google-workspace-admin/admin/directory/v1/users/{userKey}userKey can be the user's primary email or unique user ID.
Create User
POST /google-workspace-admin/admin/directory/v1/users
Content-Type: application/json
{
"primaryEmail": "newuser@example.com",
"name": {
"givenName": "Jane",
"familyName": "Smith"
},
"password": "temporaryPassword123!",
"changePasswordAtNextLogin": true,
"orgUnitPath": "/Engineering"
}Update User
PUT /google-workspace-admin/admin/directory/v1/users/{userKey}
Content-Type: application/json
{
"name": {
"givenName": "Jane",
"familyName": "Smith-Johnson"
},
"suspended": false,
"orgUnitPath": "/Sales"
}Patch User (partial update)
PATCH /google-workspace-admin/admin/directory/v1/users/{userKey}
Content-Type: application/json
{
"suspended": true
}Delete User
DELETE /google-workspace-admin/admin/directory/v1/users/{userKey}Make User Admin
POST /google-workspace-admin/admin/directory/v1/users/{userKey}/makeAdmin
Content-Type: application/json
{
"status": true
}List Groups
GET /google-workspace-admin/admin/directory/v1/groups?customer=my_customerQuery parameters:
customer- Customer ID ormy_customer(required)domain- Filter by domainmaxResults- Maximum results (1-200)userKey- List groups for a specific user
Get Group
GET /google-workspace-admin/admin/directory/v1/groups/{groupKey}groupKey can be the group's email or unique ID.
Create Group
POST /google-workspace-admin/admin/directory/v1/groups
Content-Type: application/json
{
"email": "engineering@example.com",
"name": "Engineering Team",
"description": "All engineering staff"
}Update Group
PUT /google-workspace-admin/admin/directory/v1/groups/{groupKey}
Content-Type: application/json
{
"name": "Engineering Department",
"description": "Updated description"
}Delete Group
DELETE /google-workspace-admin/admin/directory/v1/groups/{groupKey}List Members
GET /google-workspace-admin/admin/directory/v1/groups/{groupKey}/membersAdd Member
POST /google-workspace-admin/admin/directory/v1/groups/{groupKey}/members
Content-Type: application/json
{
"email": "user@example.com",
"role": "MEMBER"
}Roles: OWNER, MANAGER, MEMBER
Update Member Role
PATCH /google-workspace-admin/admin/directory/v1/groups/{groupKey}/members/{memberKey}
Content-Type: application/json
{
"role": "MANAGER"
}Remove Member
DELETE /google-workspace-admin/admin/directory/v1/groups/{groupKey}/members/{memberKey}List Org Units
GET /google-workspace-admin/admin/directory/v1/customer/my_customer/orgunitsQuery parameters:
type-all(default) orchildrenorgUnitPath- Parent org unit path
Get Org Unit
GET /google-workspace-admin/admin/directory/v1/customer/my_customer/orgunits/{orgUnitPath}Create Org Unit
POST /google-workspace-admin/admin/directory/v1/customer/my_customer/orgunits
Content-Type: application/json
{
"name": "Engineering",
"parentOrgUnitPath": "/",
"description": "Engineering department"
}Update Org Unit
PUT /google-workspace-admin/admin/directory/v1/customer/my_customer/orgunits/{orgUnitPath}
Content-Type: application/json
{
"description": "Updated description"
}Delete Org Unit
DELETE /google-workspace-admin/admin/directory/v1/customer/my_customer/orgunits/{orgUnitPath}List Domains
GET /google-workspace-admin/admin/directory/v1/customer/my_customer/domainsGet Domain
GET /google-workspace-admin/admin/directory/v1/customer/my_customer/domains/{domainName}List Roles
GET /google-workspace-admin/admin/directory/v1/customer/my_customer/rolesList Role Assignments
GET /google-workspace-admin/admin/directory/v1/customer/my_customer/roleassignmentsQuery parameters:
userKey- Filter by userroleId- Filter by role
Create Role Assignment
POST /google-workspace-admin/admin/directory/v1/customer/my_customer/roleassignments
Content-Type: application/json
{
"roleId": "123456789",
"assignedTo": "user_id",
"scopeType": "CUSTOMER"
}