# REST Resource: schemas

## Resource: Schema

The type of API resource. For Schema resources, this is always `admin#directory#schema`.

| JSON representation |
|---|
| ``` { "schemaId": string, "schemaName": string, "fields": [ { object (`https://developers.google.com/workspace/admin/directory/reference/rest/v1/schemas#SchemaFieldSpec`) } ], "displayName": string, "kind": string, "etag": string } ``` |

| Fields ||
|---|---|
| `schemaId` | `string` The unique identifier of the schema (Read-only) |
| `schemaName` | `string` The schema's name. Each `schemaName` must be unique within a customer. Reusing a name results in a `409: Entity already exists` error. |
| `fields[]` | ``object (`https://developers.google.com/workspace/admin/directory/reference/rest/v1/schemas#SchemaFieldSpec`)`` A list of fields in the schema. |
| `displayName` | `string` Display name for the schema. |
| `kind` | `string` Kind of resource this is. |
| `etag` | `string` The ETag of the resource. |

## SchemaFieldSpec

You can use schemas to add custom fields to user profiles. You can use these fields to store information such as the projects your users work on, their physical locations, their hire dates, or whatever else fits your business needs. For more information, see [Custom User Fields](https://developers.google.com/workspace/admin/directory/v1/guides/manage-schemas).

| JSON representation |
|---|
| ``` { "fieldName": string, "fieldId": string, "fieldType": string, "multiValued": boolean, "kind": string, "etag": string, "indexed": boolean, "displayName": string, "readAccessType": string, "numericIndexingSpec": { "minValue": number, "maxValue": number } } ``` |

| Fields ||
|---|---|
| `fieldName` | `string` The name of the field. |
| `fieldId` | `string` The unique identifier of the field (Read-only) |
| `fieldType` | `string` <br /> The type of the field. Acceptable values are: - `BOOL`: Boolean values. - `DATE`: Dates in [ISO-8601](http://www.w3.org/TR/NOTE-datetime) format. - `DOUBLE`: Double-precision floating-point values. - `EMAIL`: Email addresses. - `INT64`: 64-bit integer values. - `PHONE`: Phone numbers. - `STRING`: String values. |
| `multiValued` | `boolean` A boolean specifying whether this is a multi-valued field or not. Default: `false`. |
| `kind` | `string` The kind of resource this is. For schema fields this is always `admin#directory#schema#fieldspec`. |
| `etag` | `string` The ETag of the field. |
| `indexed` | `boolean` Boolean specifying whether the field is indexed or not. Default: `true`. |
| `displayName` | `string` Display Name of the field. |
| `readAccessType` | `string` <br /> Specifies who can view values of this field. See [Retrieve users as a non-administrator](https://developers.google.com/workspace/admin/directory/v1/guides/manage-users#retrieve_users_non_admin) for more information. Note: It may take up to 24 hours for changes to this field to be reflected. Acceptable values are: - `ADMINS_AND_SELF`: Only administrators and the associated user can see values. - `ALL_DOMAIN_USERS`: Any user in your domain can see values. |
| `numericIndexingSpec` | `object` Indexing spec for a numeric field. By default, only exact match queries will be supported for numeric fields. Setting the `numericIndexingSpec` allows range queries to be supported. |
| `numericIndexingSpec.minValue` | `number` Minimum value of this field. This is meant to be indicative rather than enforced. Values outside this range will still be indexed, but search may not be as performant. |
| `numericIndexingSpec.maxValue` | `number` Maximum value of this field. This is meant to be indicative rather than enforced. Values outside this range will still be indexed, but search may not be as performant. |

| ## Methods ||
|---|---|
| ### `https://developers.google.com/workspace/admin/directory/reference/rest/v1/schemas/delete` | Deletes a schema. |
| ### `https://developers.google.com/workspace/admin/directory/reference/rest/v1/schemas/get` | Retrieves a schema. |
| ### `https://developers.google.com/workspace/admin/directory/reference/rest/v1/schemas/insert` | Creates a schema. |
| ### `https://developers.google.com/workspace/admin/directory/reference/rest/v1/schemas/list` | Retrieves all schemas for a customer. |
| ### `https://developers.google.com/workspace/admin/directory/reference/rest/v1/schemas/patch` | Patches a schema. |
| ### `https://developers.google.com/workspace/admin/directory/reference/rest/v1/schemas/update` | Updates a schema. |