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

# Create Database

> Creates a new database with tables and fields.

Creates a new database with complete table and field structure in a single API call.

<Note>
  * Each table requires at least one field
  * Table names must be unique within your database
  * Field names must be unique within each table
  * Field types must match the [Field Types Reference](/help/database/api/field-types)
</Note>


## OpenAPI

````yaml help/database/openapi.json POST /bases
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

    API requests are rate limited to ensure service quality. Standard rate
    limits apply to all endpoints.


    ### Error Handling

    The API returns standard HTTP status codes and JSON error responses with
    detailed error messages.
  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
paths:
  /bases:
    post:
      tags:
        - Databases
      summary: Create database
      description: Creates a new database with tables and fields
      operationId: createDatabase
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDatabaseRequest'
      responses:
        '201':
          description: Database created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Database'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    CreateDatabaseRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: Database name
        tables:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/CreateTableInDatabase'
          description: Array of table definitions to create with the database
      required:
        - name
        - tables
    Database:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique UUID identifier for the database
          example: bad4b276-f604-47ad-86e5-d2ae4f60968f
        name:
          type: string
          description: Name of the database
        tables:
          type: array
          items:
            $ref: '#/components/schemas/Table'
          description: List of tables in the database
        createdAt:
          type: string
          format: date-time
          description: ISO timestamp of when the database was created
          example: '2025-10-18T02:08:14.784Z'
        updatedAt:
          type: string
          format: date-time
          description: ISO timestamp of when the database was last updated
          example: '2025-10-18T02:08:14.784Z'
        workspaceId:
          type: string
          description: Workspace ID that owns this database
        url:
          type: string
          format: uri
          description: URL to view this database in the app
          example: https://app.zite.com/database/bad4b276-f604-47ad-86e5-d2ae4f60968f
      required:
        - id
        - name
        - tables
        - createdAt
        - updatedAt
        - url
    CreateTableInDatabase:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: Table name
        fields:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/CreateFieldInTable'
          description: Array of field definitions to create with the table
      required:
        - name
        - fields
    Table:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the table
        name:
          type: string
          description: Name of the table
        order:
          type: integer
          description: Display order of the table
        primaryFieldId:
          type: string
          description: ID of the primary field in the table
        fields:
          type: array
          items:
            $ref: '#/components/schemas/Field'
          description: List of fields in the table
        views:
          type: array
          items:
            $ref: '#/components/schemas/View'
          description: List of views in the table
        url:
          type: string
          format: uri
          description: URL to view this table in the app
          example: >-
            https://app.zite.com/database/bad4b276-f604-47ad-86e5-d2ae4f60968f/tbl_abc123
      required:
        - id
        - name
        - order
        - primaryFieldId
        - fields
        - views
        - url
    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
    CreateFieldInTable:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/FieldType'
        name:
          type: string
          minLength: 1
          description: Field name
        template:
          type: object
          description: >-
            Field-specific configuration options. See [Field Types
            Reference](/help/database/api/field-types) for detailed template
            structure by field type.
          additionalProperties: true
      required:
        - type
        - name
        - template
    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
            Reference](/help/database/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
    View:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the view
        name:
          type: string
          description: Name of the view
        type:
          type: string
          description: Type of the view (e.g., 'grid')
        config:
          type: object
          properties:
            sorts:
              type: array
              items:
                type: object
              description: Sort configuration for the view
            hiddenFieldIds:
              type: array
              items:
                type: string
              description: Array of field IDs that are hidden in this view
            fieldWidths:
              type: object
              additionalProperties: true
              description: Field width configuration for the view
            orderedFieldIds:
              type: array
              items:
                type: string
              description: Array of field IDs in the order they appear in this view
          required:
            - sorts
            - hiddenFieldIds
            - fieldWidths
            - orderedFieldIds
          description: Configuration object for the view
      required:
        - id
        - name
        - type
        - config
    FieldType:
      type: string
      enum:
        - single_line_text
        - long_text
        - email
        - url
        - phone_number
        - number
        - currency
        - percent
        - rating
        - duration
        - single_select
        - multiple_select
        - checkbox
        - date
        - datetime
        - attachments
        - linked_record
        - lookup
        - autonumber
        - source
      description: >-
        Field type - see [Field Types Reference](/help/database/api/field-types)
        for complete list of available types and their configurations
  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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Enter your Zite API key. Format: Bearer <api_key>'

````