Members
Members are the people who sign in to the //SCHEMA console on behalf of your organization. Each has one role:
| Role | Scopes |
|---|---|
owner | all six scopes |
admin | all six scopes |
member | everything except config_write |
Owners and admins can manage members and credentials; only an owner can make someone else an owner. Nobody can change their own role or remove themselves — another administrator has to.
See Manage members.
- queryorgMembers
- querygrantableRoles
- mutationaddOrgMember
- mutationsetOrgMemberRole
- mutationremoveOrgMember
- mutationresetOrgMemberPassword
- mutationchangePassword
The OrgMember object#
A person with access to your organization.
Attributes
userPkInt!Unique identifier.emailString!Their email address, which is also their login.- Their name, if set.
roleString!owner,adminormember.statusString!invited,active,suspendedordeactivated. Onlyactivemembers can sign in.hasPasswordBoolean!Whether they have a password at all.joinedAtDateTime!When they joined your organization.- When they last signed in.
isYouBoolean!trueon the caller's own row.
List members#
Everyone with access to your organization, longest-standing first.
Arguments
None.
Returns
A list of OrgMember objects.
query {
orgMembers {
userPk
email
role
status
isYou
}
}curl https://api.schema.fm/graphql \
-H "Authorization: Bearer $SCHEMA_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"query": "query {\n orgMembers {\n userPk\n email\n role\n status\n isYou\n }\n}"
}
EOFconst res = await fetch("https://api.schema.fm/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SCHEMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `
query {
orgMembers {
userPk
email
role
status
isYou
}
}
`,
}),
});
const { data, errors } = await res.json();{
"data": {
"orgMembers": [
{ "userPk": 1001, "email": "[email protected]", "role": "owner", "status": "active", "isYou": true },
{ "userPk": 1044, "email": "[email protected]", "role": "member", "status": "active", "isYou": false }
]
}
}List grantable roles#
The roles this caller may give a member. Includes owner only for a signed-in owner.
Arguments
None.
Returns
A list of role names — member, admin, and possibly owner.
query {
grantableRoles
}curl https://api.schema.fm/graphql \
-H "Authorization: Bearer $SCHEMA_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"query": "query {\n grantableRoles\n}"
}
EOFconst res = await fetch("https://api.schema.fm/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SCHEMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `
query {
grantableRoles
}
`,
}),
});
const { data, errors } = await res.json();{
"data": {
"grantableRoles": ["member", "admin"]
}
}Add a member#
Add someone to your organization by email address.
If the address is new to //SCHEMA, an account is created and a
generated password is returned once in password. If the person
already has a //SCHEMA account (for another organization), they join
with their existing credential and password is null.
Arguments
- Who to add, and in what role.
Returns
An AddedMember.
mutation {
addOrgMember(input: { email: "[email protected]", role: "admin" }) {
userPk
role
created
password
}
}curl https://api.schema.fm/graphql \
-H "Authorization: Bearer $SCHEMA_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"query": "mutation {\n addOrgMember(input: { email: \"[email protected]\", role: \"admin\" }) {\n userPk\n role\n created\n password\n }\n}"
}
EOFconst res = await fetch("https://api.schema.fm/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SCHEMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `
mutation {
addOrgMember(input: { email: "[email protected]", role: "admin" }) {
userPk
role
created
password
}
}
`,
}),
});
const { data, errors } = await res.json();{
"data": {
"addOrgMember": {
"userPk": 1052,
"role": "admin",
"created": true,
"password": "7KQ2M-D9XHT-4VRWB-P3NZE"
}
}
}Change a member's role#
Give a member a different role. You cannot change your own role,
only an owner can grant owner, and the last owner cannot be
demoted.
Arguments
- The member.
owner,adminormember.
Returns
true on success.
mutation {
setOrgMemberRole(userPk: 1044, role: "admin")
}curl https://api.schema.fm/graphql \
-H "Authorization: Bearer $SCHEMA_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"query": "mutation {\n setOrgMemberRole(userPk: 1044, role: \"admin\")\n}"
}
EOFconst res = await fetch("https://api.schema.fm/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SCHEMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `
mutation {
setOrgMemberRole(userPk: 1044, role: "admin")
}
`,
}),
});
const { data, errors } = await res.json();{
"data": {
"setOrgMemberRole": true
}
}Remove a member#
Remove someone from your organization. Their access ends on their next request. Their //SCHEMA account survives, since it may belong to other organizations. You cannot remove yourself.
Arguments
- The member to remove.
Returns
true if they were a member and were removed; false otherwise.
mutation {
removeOrgMember(userPk: 1044)
}curl https://api.schema.fm/graphql \
-H "Authorization: Bearer $SCHEMA_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"query": "mutation {\n removeOrgMember(userPk: 1044)\n}"
}
EOFconst res = await fetch("https://api.schema.fm/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SCHEMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `
mutation {
removeOrgMember(userPk: 1044)
}
`,
}),
});
const { data, errors } = await res.json();{
"data": {
"removeOrgMember": true
}
}Reset a member's password#
Replace a member's password with a generated one and sign them out everywhere. The new password is returned once.
Refused for your own account (use changePassword) and for anyone who also belongs to another organization — their credential is not yours to replace.
Arguments
- The member.
Returns
The new password.
mutation {
resetOrgMemberPassword(userPk: 1044)
}curl https://api.schema.fm/graphql \
-H "Authorization: Bearer $SCHEMA_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"query": "mutation {\n resetOrgMemberPassword(userPk: 1044)\n}"
}
EOFconst res = await fetch("https://api.schema.fm/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SCHEMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `
mutation {
resetOrgMemberPassword(userPk: 1044)
}
`,
}),
});
const { data, errors } = await res.json();{
"data": {
"resetOrgMemberPassword": "R8WEM-2KT9C-HX4QZ-B7NPA"
}
}Change your password#
Change the signed-in user's own password. Requires the current password. Every other session of yours is signed out; the one making this request stays signed in.
Only for signed-in users — an API key has no password, and the request is refused.
Arguments
- Your current password.
- The new password.
Returns
true on success.
mutation ChangePassword($old: String!, $new: String!) {
changePassword(oldPassword: $old, newPassword: $new)
}{
"old": "correct horse battery",
"new": "staple orbit lantern fjord"
}curl https://api.schema.fm/graphql \
-H "Authorization: Bearer $SCHEMA_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"query": "mutation ChangePassword($old: String!, $new: String!) {\n changePassword(oldPassword: $old, newPassword: $new)\n}",
"variables": {
"old": "correct horse battery",
"new": "staple orbit lantern fjord"
}
}
EOFconst res = await fetch("https://api.schema.fm/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SCHEMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `
mutation ChangePassword($old: String!, $new: String!) {
changePassword(oldPassword: $old, newPassword: $new)
}
`,
variables: {
"old": "correct horse battery",
"new": "staple orbit lantern fjord"
},
}),
});
const { data, errors } = await res.json();{
"data": {
"changePassword": true
}
}