Organizations (GQL)

Create an organization

Creates an organization owned by the logged in user. That user is automatically an org admin for the organization. The input.email field is used to specify the email address that invoices and notifications will be sent to. This value is shown in the Organization Dashboard in the Organization Settings tab.

The thumbnail field can contain a full URL or a reference to a file on the local computer (for example, "/static-assets/default/teamContext.svg").

The input.users field is used to invite users to the organization. It should contain an array of one or more objects. The user can be specified by email address or by Rapid user id. The name of the invited user's role can also be specified. If you would like to automatically add instead of invite users to the organization, you could alternatively use the REST Platform API's Add Team User(s) endpoint.

Note that creating an organization will automatically create a default team, a default app for that team, and a special type of subscription of type SEATS for the organization. You can view these creation events using the Events tab.

mutation CreateOrganization ($input: OrganizationCreateInput!) {
  createOrganization(input:$input) {
    name,
    id
  }
}
{
  "input": {
    "name": "Org X",
    "email": "[email protected]",
    "seats": 7,
    "thumbnail": "https://rapidapi.com/cdn/images?url=https://rapidapi-prod-apis.s3.amazonaws.com/abab68f8-9131-40db-861c-3b971503e4c2.png",
    "users": [
      {
        "email": "[email protected]",
        "role": "ADMIN"
      },
      {
        "id": "5753721",
        "role": "DEVELOPER"
      }
    ]
  }
}

Obtain an organization's details by ID

Lists an organization's details given its organization ID. The calling user must be a member of the organization.

๐Ÿ“˜

query.organizations

There is also a query.organizations query shown below.

query Organization ($id: ID!) {
  organization(id: $id) {
    id
    name
    slugifiedName
    teams {
      id
      name
      ProjectAcls {
        Project {
          id
          name
          description
          thumbnail
          mashapeId
          enableLimitsToAPIs
          projectAllowedAPIs {
            id
          }
        }
      }
    }
    users {
      name
      email
      id
    }
  }
}
{
  "id": ORG_ID
}

In the response, the ProjectAcls section contains App information (id and name). Apps are called "Projects" in the Platform API. Apps are shown in the Developer Dashboard (Apps).

Obtain one or more organization's details

๐Ÿ“˜

Alternative query

The query below assumes the calling user is an org admin. To obtain the list of organizations that any user belongs to, use query.users. See Users, Teams, and Roles (GQL)

๐Ÿ“˜

Alternative query

If you are interested in obtaining a single organization's detail by its ID, see the query.organization query above.

Lists one or more organization's details, including teams and users. The x-rapidapi-identity-key must be the Personal Account key of an org admin in the organization. See Authorization (GQL). Only organizations in which the Personal Account key is a an org admin will be returned.

Variables can be set with userID, which lists all organizations for which the calling user is a member, or with slugifiedName, which lists a single organization's details. If you do not set either variable, the result lists all organizations for which the calling user is an org admin.

In the response, the ProjectAcls section contains App information (id and name). Apps are called "Projects" in the Platform API. Apps are shown in the Developer Dashboard (Apps).

query Organizations($where: OrganizationWhereInput!) {
  organizations(where: $where) {
    name
    slugifiedName
    id
    teams {
      id
      name
      ProjectAcls {
          Project {
            id 
            name
          }
      }
    }
    users {
      name
      email
      id
    }
  }
}
{
  "where": {
    "userId": YOUR_USER_ID
  }
}
{
  "where": {
    "slugifiedName": "platform-management"
  }
}

Update an organization

Use the input.seats to update the org's number of seats. The thumbnail field can contain a full URL or a reference to a file on the local computer (for example, "/static-assets/default/teamContext.svg").

mutation UpdateOrganization($input: OrganizationUpdateInput!) {
  updateOrganization (input: $input){
    billingAdditionalValues {
      total
    }
  }
}
{
  "input": {
    "organizationId": ORG_ID,
    "seats": 35,
    ""thumbnail": "https://rapidapi.com/cdn/images?url=https://rapidapi-prod-apis.s3.amazonaws.com/abab68f8-9131-40db-861c-3b971503e4c2.png"
  }
}

Delete an organization

mutation DeleteOrganization {
  deleteOrganization(id: int)
}