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

# Bulk Create Records

> Create or upsert up to 100 records in a single request using either table ID or table name.

<Note>
  Use field names or field IDs as keys and field values as data (e.g., `"Email": "user@example.com"` or `"fwtJyga6dso": "user@example.com"`).
</Note>

## Upsert with `matchOn`

Provide `matchOn` with one or more **field IDs** to upsert instead of always creating. Incoming records that match an existing record on **all** of the `matchOn` fields update that record; the rest are created.

```json theme={null}
{
  "records": [
    { "Email": "john@example.com", "Name": "John Doe" },
    { "Email": "jane@example.com", "Name": "Jane Roe" }
  ],
  "matchOn": ["k8mNp2xQ9rL"]
}
```

<Warning>
  Unlike the keys inside each record, `matchOn` accepts **field IDs only** — field names are rejected. A record's field IDs are the keys of the `data` object returned by any record endpoint (for example, [List records](/api/records/list-records)).
</Warning>

<Tip>
  A pure create (no `matchOn`) returns `201 Created`. An upsert (with `matchOn`) returns `200 OK`. In both cases the response contains the resulting records.
</Tip>

Any `id` field included in a record is ignored — record IDs are always generated by the database.


## OpenAPI

````yaml api/openapi.json POST /bases/{databaseId}/tables/{tableId}/records/bulk
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
  - name: SQL
    description: Run read-only SQL queries against a database and inspect its SQL schema
paths:
  /bases/{databaseId}/tables/{tableId}/records/bulk:
    post:
      tags:
        - Records
      summary: Bulk create or upsert records
      description: >-
        Creates up to 100 records in a single request. When `matchOn` is
        provided, records that match existing records on the given fields are
        updated instead of created (upsert).
      operationId: bulkCreateRecords
      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/BulkCreateRecordsRequest'
      responses:
        '200':
          description: Records upserted successfully (returned when `matchOn` is provided)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkRecordsResponse'
        '201':
          description: Records created successfully (pure create)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkRecordsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    BulkCreateRecordsRequest:
      type: object
      properties:
        records:
          type: array
          minItems: 1
          maxItems: 100
          description: >-
            The records to create. Each record is an object of field data using
            field names or field IDs as keys.
          items:
            type: object
            additionalProperties: true
            description: >-
              Record data with field names or field IDs as keys and their
              corresponding values.
        matchOn:
          type: array
          minItems: 1
          maxItems: 20
          items:
            type: string
          description: >-
            Optional list of field IDs to match on for upsert (field IDs only —
            not field names, unlike the keys inside each record). When provided,
            an incoming record that matches an existing record on all of these
            fields updates that record instead of creating a new one.
          example:
            - k8mNp2xQ9rL
      required:
        - records
      example:
        records:
          - Name: John Doe
            Email: john@example.com
            Priority: high
          - Name: Jane Roe
            Email: jane@example.com
            Priority: low
    BulkRecordsResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the bulk operation succeeded.
        records:
          type: array
          items:
            $ref: '#/components/schemas/Record'
          description: The created, upserted, or updated records.
      required:
        - success
        - records
    Record:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique UUID identifier for the record
        data:
          type: object
          additionalProperties: true
          description: Record data with field IDs as keys
          example:
            fwtJyga6dso: John Doe
            k8mNp2xQ9rL: john.doe@newcompany.com
            vB3zXc7Hf2w: low
        fields:
          type: object
          additionalProperties: true
          description: Record data with field names as keys
          example:
            Name: John Doe
            Email: john.doe@newcompany.com
            Priority: low
        createdAt:
          type: string
          format: date-time
          description: ISO timestamp of when the record was created
        updatedAt:
          type: string
          format: date-time
          description: ISO timestamp of when the record was last updated
      required:
        - id
        - data
        - fields
        - createdAt
        - updatedAt
    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>'

````