Skip to content
LogoLogo

Organization schema

See Management API schema for every domain, the endpoint and authentication.

Queries

organization

Reads an organization by ID or slug. Null when no organization matches. Scope: ORGANIZATION_READ.

organization(input: OrganizationInput!): Organization @auth

organizations

Lists the organizations the user belongs to. search matches a case-insensitive substring of the name. Empty for an API key.

organizations(first: Int, after: String, search: String, sortKey: OrganizationSortKeys = NAME, reverse: Boolean = false): OrganizationConnection! @auth

Mutations

organizationCreate

Creates an organization owned by the calling user. Scope: ORGANIZATION_CREATE.

organizationCreate(input: OrganizationCreateInput!): OrganizationCreatePayload! @auth

organizationUpdate

Updates an organization. Scope: ORGANIZATION_UPDATE.

organizationUpdate(input: OrganizationUpdateInput!): OrganizationUpdatePayload! @auth

organizationDelete

Deletes an organization. Scope: ORGANIZATION_DELETE.

organizationDelete(input: OrganizationDeleteInput!): OrganizationDeletePayload! @auth

organizationMemberInvite

Invites an email address to an organization and emails the invitee. delivery says which email went out. Scope: ORGANIZATION_INVITATIONS_CREATE.

organizationMemberInvite(input: OrganizationMemberInviteInput!): OrganizationMemberInvitePayload! @auth

organizationInvitationAccept

Accepts an invitation, making the calling user a member with the scopes it carries. An invitation a user sent grants only the scopes that user holds when it is accepted, and fails once they leave the organization unless they are a super admin or a client manager; one an API key sent fails once the key is revoked. The invitation is used up; an unknown or expired token, one sent to another email address, or an existing membership, fails.

organizationInvitationAccept(input: OrganizationInvitationAcceptInput!): OrganizationInvitationAcceptPayload! @auth

organizationInvitationDecline

Declines an invitation addressed to the calling user's email address and deletes it.

organizationInvitationDecline(input: OrganizationInvitationDeclineInput!): OrganizationInvitationDeclinePayload! @auth

organizationInvitationRevoke

Revokes a pending invitation, so its token stops working. Scope: ORGANIZATION_INVITATIONS_DELETE.

organizationInvitationRevoke(input: OrganizationInvitationRevokeInput!): OrganizationInvitationRevokePayload! @auth

organizationMemberRemove

Removes a member from an organization, with every scope they held there and the invitations they sent into it. The primary owner cannot be removed. Scope: ORGANIZATION_MEMBERS_DELETE.

organizationMemberRemove(input: OrganizationMemberRemoveInput!): OrganizationMemberRemovePayload! @auth

organizationMemberScopesUpdate

Sets the scopes a member holds in an organization. The caller cannot edit their own scopes, grant a scope they do not hold, or take ORGANIZATION_MEMBERS_MANAGE_SCOPES from the primary owner. Scope: ORGANIZATION_MEMBERS_MANAGE_SCOPES.

organizationMemberScopesUpdate(input: OrganizationMemberScopesUpdateInput!): OrganizationMemberScopesUpdatePayload! @auth

organizationClientManagerScopesUpdate

Sets the scopes a client manager holds in one organization. The caller cannot edit their own scopes, and a client manager can add or remove only scopes they hold there themselves. Scope: STAFF_INVITE_CLIENT_MANAGER.

organizationClientManagerScopesUpdate(input: OrganizationClientManagerScopesUpdateInput!): OrganizationClientManagerScopesUpdatePayload! @auth

Types

OrganizationSortKeys

"""
The orders an organization list can take. `reverse: true` flips the order.
"""
enum OrganizationSortKeys {
  """By name, A to Z."""
  NAME
  """By creation time, oldest first."""
  CREATED_AT
  """By last change, oldest first."""
  UPDATED_AT
}

InvitationType

"""
The kind of an invitation. Every invitation is single-use and expires 30 days after it is
created.
"""
enum InvitationType {
  """Single-use, expiring after 30 days."""
  ONE_TIME @deprecated(reason: "All invitations are now single-use with 30-day expiration")
  """Multi-use, expiring after 24 hours. Not issued."""
  TWENTY_FOUR_HOUR @deprecated(reason: "All invitations are now single-use with 30-day expiration")
}

Organization

"""
The top level of Picked. It holds your projects, members, API keys and integrations.
"""
type Organization {
  """The ID of the organization."""
  id: ID!
  """The name of the organization."""
  name: String!
  """
  The unique handle of the organization in dashboard URLs. Null when it has none.
  """
  slug: String
  """When the organization was created."""
  createdAt: DateTime!
  """When the organization last changed."""
  updatedAt: DateTime!
  """
  Whether every member must hold an `AAL2` session. A member of such an organization is held to
  it on every request, whichever organization the request names.
  """
  requireMfa: Boolean!
  """
  The members of the organization. Picked staff are not listed.
  Scope: `ORGANIZATION_MEMBERS_READ`.
  """
  members(first: Int, after: String): OrganizationMemberConnection!
  """
  The unexpired invitations of the organization, newest first.
  Scope: `ORGANIZATION_INVITATIONS_READ`.
  """
  invitations(first: Int, after: String): OrganizationInvitationConnection!
  """
  The projects in the organization. `search` matches a case-insensitive substring of the name.
  Scope: `ORGANIZATION_PROJECTS_READ`.
  """
  projects(first: Int, after: String, search: String, sortKey: ProjectSortKeys = NAME, reverse: Boolean = false): ProjectConnection!
  """
  The API keys of the organization.
  Scope: `ORGANIZATION_API_KEYS_READ`.
  """
  apiKeys(first: Int, after: String): ApiKeyConnection!
  """
  The organization's own labels, such as a counter or a lock that every project in it shares,
  ordered by namespace then key. Expired labels are left out. Write them with `labelsSet` and
  `ownerType: ORGANIZATION`.
  Scope: `ORGANIZATION_READ`.
  """
  labels: [Label!]! @auth
  """The scopes the viewer holds in the organization."""
  viewerScopes: [Scope!]!
  """
  Every client manager, with the scopes they hold in the organization. Empty unless the viewer
  holds `STAFF_READ`.
  """
  clientManagerAccess: [OrganizationClientManagerAccess!]!
}

OrganizationMember

"""A person in an organization."""
type OrganizationMember {
  """The ID of the member's user."""
  id: ID!
  """The email address of the member. Null when unknown."""
  userEmail: String
  """The first name of the member. Null when unknown."""
  userFirstName: String
  """The last name of the member. Null when unknown."""
  userLastName: String
  """The time of the request. The join time is not recorded."""
  joinedAt: DateTime!
  """Whether the member has a verified MFA factor."""
  mfaState: MfaState!
  """
  The scopes the member holds in the organization, one entry per location. Empty unless the
  viewer holds `ORGANIZATION_MEMBERS_MANAGE_SCOPES` in the organization.
  """
  scopeGrants: [MemberScopeGrant!]!
}

MemberScopeGrant

"""The scopes a member holds at one location in an organization."""
type MemberScopeGrant {
  """
  The ID of the project the scopes apply to. Null for the organization itself.
  """
  projectId: ID
  """The scopes held at the location."""
  scopes: [Scope!]!
}

OrganizationClientManagerAccess

"""
A client manager and the scopes they hold in one organization, on top of the root grant that
reaches every organization.
"""
type OrganizationClientManagerAccess {
  """The client manager."""
  user: AdminUser!
  """
  The scopes the client manager holds in the organization. Empty when they hold none.
  """
  scopes: [Scope!]!
}

OrganizationMemberEdge

"""A member in a page of results."""
type OrganizationMemberEdge {
  """The cursor of this edge."""
  cursor: String!
  """The member."""
  node: OrganizationMember!
}

OrganizationMemberConnection

"""A page of organization members."""
type OrganizationMemberConnection {
  """The edges in this page."""
  edges: [OrganizationMemberEdge!]!
  """Where this page sits in the list."""
  pageInfo: PageInfo!
  """The total number of members."""
  totalCount: Int!
}

OrganizationInvitation

"""
An offer to join an organization, sent to an email address. It is single-use, expires 30 days
after it is created, and is removed once accepted, declined or revoked.
"""
type OrganizationInvitation {
  """The ID of the invitation."""
  id: ID!
  """Always `ONE_TIME`."""
  invitationType: InvitationType! @deprecated(reason: "All invitations are now single-use. This field will be removed.")
  """When the invitation was created."""
  createdAt: DateTime!
  """When the invitation expires."""
  expiresAt: DateTime!
  """The email address the invitation was sent to."""
  userEmail: String
}

OrganizationInvitationEdge

"""An invitation in a page of results."""
type OrganizationInvitationEdge {
  """The cursor of this edge."""
  cursor: String!
  """The invitation."""
  node: OrganizationInvitation!
}

OrganizationInvitationConnection

"""A page of organization invitations."""
type OrganizationInvitationConnection {
  """The edges in this page."""
  edges: [OrganizationInvitationEdge!]!
  """Where this page sits in the list."""
  pageInfo: PageInfo!
  """The total number of unexpired invitations."""
  totalCount: Int!
}

ViewerInvitation

"""
An invitation addressed to the viewer's email address. Its `token` lets the bearer join the
organization, so treat it as a secret.
"""
type ViewerInvitation {
  """The ID of the invitation."""
  id: ID!
  """The token that accepts or declines the invitation."""
  token: String!
  """The name of the inviting organization."""
  organizationName: String!
  """When the invitation was created."""
  createdAt: DateTime!
  """When the invitation expires."""
  expiresAt: DateTime!
}

ViewerInvitationEdge

"""An invitation in a page of results."""
type ViewerInvitationEdge {
  """The cursor of this edge."""
  cursor: String!
  """The invitation."""
  node: ViewerInvitation!
}

ViewerInvitationConnection

"""A page of the viewer's invitations."""
type ViewerInvitationConnection {
  """The edges in this page."""
  edges: [ViewerInvitationEdge!]!
  """Where this page sits in the list."""
  pageInfo: PageInfo!
  """The total number of invitations."""
  totalCount: Int!
}

OrganizationEdge

"""An organization in a page of results."""
type OrganizationEdge {
  """The cursor of this edge."""
  cursor: String!
  """The organization."""
  node: Organization!
}

OrganizationConnection

"""A page of organizations."""
type OrganizationConnection {
  """The edges in this page."""
  edges: [OrganizationEdge!]!
  """Where this page sits in the list."""
  pageInfo: PageInfo!
  """The total number of organizations."""
  totalCount: Int!
}

OrganizationInput

"""
The input of `organization`. Give `id` or `slug`; `id` wins when both are given.
"""
input OrganizationInput {
  """The ID of the organization."""
  id: ID
  """The slug of the organization."""
  slug: String
}

OrganizationCreateInput

"""The input of `organizationCreate`."""
input OrganizationCreateInput {
  """The name of the organization."""
  name: String!
  """
  The slug of the organization: lowercase letters, numbers and hyphens, unique across Picked. A
  few words that name dashboard pages, such as `account` and `login`, are reserved.
  """
  slug: String!
}

OrganizationCreatePayload

"""The result of `organizationCreate`."""
type OrganizationCreatePayload {
  """The created organization."""
  organization: Organization
}

OrganizationUpdateInput

"""The input of `organizationUpdate`. Omit a field to keep its value."""
input OrganizationUpdateInput {
  """The ID of the organization."""
  id: ID!
  """The name of the organization."""
  name: String
  """The slug of the organization, under the same rules as on create."""
  slug: String
  """
  Whether every member must hold an `AAL2` session. Changing it in either direction needs the
  caller's own user session at `AAL2`, else fails with `MFA_REQUIRED`, so an API key cannot change
  it. Turning it on signs every member out of their OAuth clients.
  """
  requireMfa: Boolean
}

OrganizationUpdatePayload

"""The result of `organizationUpdate`."""
type OrganizationUpdatePayload {
  """The updated organization."""
  organization: Organization
}

OrganizationDeleteInput

"""The input of `organizationDelete`."""
input OrganizationDeleteInput {
  """The ID of the organization."""
  id: ID!
}

OrganizationDeletePayload

"""The result of `organizationDelete`."""
type OrganizationDeletePayload {
  """The ID of the deleted organization."""
  deletedOrganizationId: ID
}

OrganizationMemberInviteInput

"""The input of `organizationMemberInvite`."""
input OrganizationMemberInviteInput {
  """The ID of the organization."""
  organizationId: ID!
  """The email address to invite."""
  email: String!
  """
  The scopes the invitation grants on acceptance, one entry per location. Omit to grant
  `ORGANIZATION_READ` alone. The inviter cannot grant a scope they do not hold.
  """
  grants: [MemberScopeGrantInput!]
  """Ignored."""
  invitationType: InvitationType @deprecated(reason: "All invitations are now single-use. This field is ignored.")
  """The URL the email's link returns the invitee to."""
  redirectUrl: String
}

InvitationDelivery

"""Which email reached the person an invitation was sent to."""
enum InvitationDelivery {
  """An invitation email, for an address with no account."""
  INVITE_EMAIL
  """
  A sign-in email, for an address that already has an account. The invitation waits on the
  user's Account page.
  """
  SIGN_IN_EMAIL
  """
  No email. The invitation still waits on the Account page of a user with the address.
  """
  NOT_SENT
}

OrganizationMemberInvitePayload

"""The result of `organizationMemberInvite`."""
type OrganizationMemberInvitePayload {
  """The created invitation."""
  invitation: OrganizationInvitation
  """Which email reached the invitee."""
  delivery: InvitationDelivery!
}

OrganizationInvitationAcceptInput

"""The input of `organizationInvitationAccept`."""
input OrganizationInvitationAcceptInput {
  """
  The token of the invitation, from `ViewerInvitation.token` or the invitation email.
  """
  token: String!
}

AcceptedMembership

"""The organization a user joined by accepting an invitation."""
type AcceptedMembership {
  """The ID of the organization."""
  organizationId: ID!
  """The name of the organization."""
  organizationName: String!
}

OrganizationInvitationAcceptPayload

"""The result of `organizationInvitationAccept`."""
type OrganizationInvitationAcceptPayload {
  """The organization joined."""
  membership: AcceptedMembership
}

OrganizationInvitationDeclineInput

"""The input of `organizationInvitationDecline`."""
input OrganizationInvitationDeclineInput {
  """The token of the invitation."""
  token: String!
}

OrganizationInvitationDeclinePayload

"""The result of `organizationInvitationDecline`."""
type OrganizationInvitationDeclinePayload {
  """The token of the declined invitation."""
  declinedToken: String
}

OrganizationInvitationRevokeInput

"""The input of `organizationInvitationRevoke`."""
input OrganizationInvitationRevokeInput {
  """The ID of the invitation."""
  invitationId: ID!
  """Ignored. The invitation's own organization applies."""
  organizationId: ID!
}

OrganizationInvitationRevokePayload

"""The result of `organizationInvitationRevoke`."""
type OrganizationInvitationRevokePayload {
  """The ID of the revoked invitation."""
  revokedInvitationId: ID
}

OrganizationMemberRemoveInput

"""The input of `organizationMemberRemove`."""
input OrganizationMemberRemoveInput {
  """The ID of the organization."""
  organizationId: ID!
  """The ID of the member's user."""
  userId: ID!
}

OrganizationMemberRemovePayload

"""The result of `organizationMemberRemove`."""
type OrganizationMemberRemovePayload {
  """The ID of the removed member's user."""
  removedUserId: ID
}

MemberScopeGrantInput

"""
The scopes to grant at one location in an organization. A grant on the organization itself
always includes `ORGANIZATION_READ`.
"""
input MemberScopeGrantInput {
  """
  The ID of the project the scopes apply to. Null for the organization itself.
  """
  projectId: ID
  """The scopes to hold at the location."""
  scopes: [Scope!]!
}

OrganizationMemberScopesUpdateInput

"""
The input of `organizationMemberScopesUpdate`. Every field is required.
"""
input OrganizationMemberScopesUpdateInput {
  """The ID of the organization."""
  organizationId: ID!
  """The ID of the member's user."""
  userId: ID!
  """
  Every grant the member keeps in the organization, at most one per location. A location left
  out loses its grant. `ORGANIZATION_MEMBERS_MANAGE_SCOPES` applies to the organization only.
  """
  grants: [MemberScopeGrantInput!]!
}

OrganizationMemberScopesUpdatePayload

"""The result of `organizationMemberScopesUpdate`."""
type OrganizationMemberScopesUpdatePayload {
  """The member whose scopes were set."""
  member: OrganizationMember
}

OrganizationClientManagerScopesUpdateInput

"""
The input of `organizationClientManagerScopesUpdate`. Every field is required.
"""
input OrganizationClientManagerScopesUpdateInput {
  """The ID of the organization."""
  organizationId: ID!
  """The ID of the client manager's user."""
  userId: ID!
  """
  The scopes to hold in the organization, replacing the current ones. An empty list clears them,
  leaving the root grant. A scope that applies to every organization fails validation.
  """
  scopes: [Scope!]!
}

OrganizationClientManagerScopesUpdatePayload

"""The result of `organizationClientManagerScopesUpdate`."""
type OrganizationClientManagerScopesUpdatePayload {
  """The client manager and the scopes they now hold."""
  access: OrganizationClientManagerAccess
}