Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.plain.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Using TypeScript? Check out our GraphQL SDK for a fully typed client.
We provide a number of methods for fetching tenants:
  1. Get tenants to fetch more than one tenant at a time.
  2. Get tenant by ID
  3. Search for tenants
For all of these queries you need the following permissions:
  • tenant:read

Get tenants

Our API allows you to fetch tenants as a collection using the tenants query in GraphQL. This endpoint supports Pagination.
Query
query tenants($first: Int, $after: String, $last: Int, $before: String) {
  tenants(first: $first, after: $after, last: $last, before: $before) {
    edges {
      cursor
      node {
        id
        name
        externalId
        url
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
Variables
{
  "first": 25
}

Get tenant by ID

If you know the tenant’s ID in Plain you can use this method to fetch the tenant. Generally speaking it’s preferable to use upsert when you have the full details of the tenant.
Query
query tenant($tenantId: ID!) {
  tenant(tenantId: $tenantId) {
    id
    externalId
    name
    url
  }
}
Variables
{
  "tenantId": "te_123"
}

Search for tenants

The searchTenants query lets you do a case-insensitive partial match on a tenant’s name as well as an exact match on its external ID. The search term must be at least 2 characters long.
Query
query searchTenants($term: String!, $first: Int = 25, $after: String) {
  searchTenants(searchQuery: { term: $term }, first: $first, after: $after) {
    edges {
      node {
        tenant {
          id
          name
          externalId
          url
        }
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
Variables
{
  "term": "acme",
  "first": 25
}