> ## Documentation Index
> Fetch the complete documentation index at: https://developers.zite.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Field

> Adds a new field to an existing table using either table ID or table name.

> [!NOTE]
>
> Both `type` and `name` are required. The `template` object structure varies by field type - see [Field Types Reference](https://developers.zite.com/api/field-types.md) for complete details

## Example Field Creation

Here's how to create a single select field:

```json theme={"system"}
{
  "type": "single_select",
  "name": "Status",
  "template": {
    "options": [
      {"label": "Active", "color": "green"},
      {"label": "Inactive", "color": "gray"},
      {"label": "Pending", "color": "yellow"},
      {"label": "Archived", "color": "red"}
    ]
  }
}
```

Option colors are palette keys (`purple`, `orange`, `blue`, `gray`, `red`, `yellow`, `green`, `pink`, `lime`, `tangerine`, `emerald`, `sky`, `teal`, `indigo`, `cyan`, `violet`, `fuchsia`), not hex codes. Omit `color` to have one assigned.


## OpenAPI

````yaml api/openapi.json POST /bases/{databaseId}/tables/{tableId}/fields
openapi: 3.0.1
info:
  title: Zite DB REST API
  description: >-
    A REST API for managing Zite databases, tables, fields, and records. Build
    database-driven applications with programmatic access to your structured
    data.


    ## What is REST API


    A **REST API** simplifies interaction with your database data, allowing for
    automation and integration. Following RESTful principles, it seamlessly
    connects to retrieve, create, and modify database data.


    ## Getting Started


    ### Authentication

    All API requests require authentication using your Zite API key in the
    Authorization header:

    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    ### Base URL

    https://tables.zite.com/api/v1


    ### Rate Limits

    Requests are limited to 30 per second per database. Responses carry
    `RateLimit-*` headers, and a request over the limit returns `429 Too Many
    Requests` with a `Retry-After` header and the body `{ "statusCode": 429,
    "error": "Too Many Requests", "message": "..." }`.


    ### Error Handling

    The API returns standard HTTP status codes. Error bodies have the shape `{
    "error": { "code", "message" } }`, except `429` responses (see Rate Limits).
  version: 1.0.0
servers:
  - url: https://tables.zite.com/api/v1
    description: Zite DB API
security:
  - bearerAuth: []
tags:
  - name: Databases
    description: Operations for managing databases
  - name: Tables
    description: Operations for managing tables within databases
  - name: Fields
    description: Operations for managing fields within tables
  - name: Records
    description: Operations for managing records within tables
  - name: Webhooks
    description: >-
      Operations for managing webhook subscriptions to receive real-time
      notifications when database events occur
  - name: SQL
    description: Run read-only SQL queries against a database and inspect its SQL schema
paths:
  /bases/{databaseId}/tables/{tableId}/fields:
    post:
      tags:
        - Fields
      summary: Create field
      description: Adds a new field to an existing table
      operationId: createField
      parameters:
        - name: databaseId
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the database
        - name: tableId
          in: path
          required: true
          schema:
            type: string
          description: >-
            The unique identifier of the table. You can also use the table name
            instead of the ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFieldRequest'
      responses:
        '201':
          description: Field created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Field'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    CreateFieldRequest:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/FieldType'
        name:
          type: string
          minLength: 1
          description: Field name
        template:
          type: object
          additionalProperties: true
          description: >-
            Field-specific configuration. Optional, except for `linked_record`,
            `lookup`, `rollup`, and `formula`; `source` needs an empty object
            (`{}`). See [Field types](/api/field-types) for the template of each
            type.
      required:
        - type
        - name
      example:
        type: single_select
        name: Status
        template:
          options:
            - label: Active
              color: green
            - label: Inactive
              color: gray
    Field:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the field
        name:
          type: string
          description: Name of the field
        type:
          $ref: '#/components/schemas/FieldType'
        template:
          type: object
          description: >-
            Field-specific configuration options. See [Field
            types](/api/field-types) for detailed template structure by field
            type.
          additionalProperties: true
        order:
          type: integer
          description: Display order of the field
      required:
        - id
        - name
        - type
        - template
        - order
    FieldType:
      type: string
      enum:
        - single_line_text
        - long_text
        - rich_text
        - email
        - url
        - phone_number
        - number
        - currency
        - percent
        - rating
        - duration
        - single_select
        - multiple_select
        - checkbox
        - date
        - datetime
        - attachments
        - linked_record
        - lookup
        - rollup
        - formula
        - autonumber
        - source
        - created_at
        - updated_at
        - created_by
        - updated_by
        - user
      description: >-
        Field type. See [Field types](/api/field-types) for the value shape and
        template of each type.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
            message:
              type: string
              description: Human-readable error message
          required:
            - code
            - message
      required:
        - error
  responses:
    BadRequest:
      description: Invalid request data or validation failure
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalidRecordId:
              value:
                error:
                  code: INVALID_RECORD_ID
                  message: Record ID is not in valid UUID format
            validationError:
              value:
                error:
                  code: BAD_REQUEST
                  message: Invalid request data or validation failure
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: UNAUTHORIZED
              message: Invalid or missing API key
    NotFound:
      description: Requested resource does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: NOT_FOUND
              message: Requested resource does not exist
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Enter your Zite API key. Format: Bearer <api_key>'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.