> ## 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.

# Tenant fields

<Snippet file="graphql/sdk-note.mdx" />

Tenant fields are custom fields you can attach to a tenant — for example a plan name, MRR, account owner or any other attribute that is meaningful at the tenant level rather than per-customer.

Working with tenant fields involves two layers:

1. **Tenant field schemas** define what fields exist (type, label, options). You create the schema once.
2. **Tenant field values** are the per-tenant values stored against a given schema.

This is the same model as thread fields — see [thread fields](/graphql/threads/thread-fields) for the equivalent on threads.

These operations require the following permissions:

* `tenant:edit`
* `tenantFieldSchema:create` / `tenantFieldSchema:edit` / `tenantFieldSchema:delete` (for schema operations)

## Create or update tenant field schemas

`upsertTenantFieldSchema` accepts an array of schemas to create or update in one call. Each schema is identified by the combination of `source` and `externalFieldId`.

Supported field types are `STRING_TYPE`, `NUMBER_TYPE`, `BOOLEAN_TYPE`, `STRING_ARRAY`, `DATETIME_TYPE` and `ENUM_TYPE` (use `options` to define the allowed values).

<Snippet file="graphql/upsert-tenant-field-schema.mdx" />

## Delete a tenant field schema

Deleting a schema also removes any tenant field values stored against it.

<Snippet file="graphql/delete-tenant-field-schema.mdx" />

## Set a tenant field value

Once a schema exists, use `upsertTenantField` to set or update the value for a specific tenant. Pass exactly one of `stringValue`, `numberValue`, `booleanValue`, `arrayValue` or `dateValue` matching the schema's `type`.

<Snippet file="graphql/upsert-tenant-field.mdx" />

## Delete a tenant field value

To clear a tenant's value for a specific field without removing the schema itself, call `deleteTenantField`.

<Snippet file="graphql/delete-tenant-field.mdx" />
