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

# Auto-fill a field by AI

> Automatically generate suggestions for filling a specific field



## OpenAPI

````yaml /swagger.json post /table/{tableId}/field/{fieldId}/auto-fill
openapi: 3.0.0
info:
  version: 1.0.0
  title: Teable App
  description: Manage Data as easy as drink a cup of tea
  x-logo:
    backgroundColor: '#F0F0F0'
    altText: Teable logo
servers:
  - url: https://app.teable.ai/api
security: []
paths:
  /table/{tableId}/field/{fieldId}/auto-fill:
    post:
      tags:
        - field
      summary: Auto-fill a field by AI
      description: Automatically generate suggestions for filling a specific field
      parameters:
        - schema:
            type: string
          required: true
          name: tableId
          in: path
        - schema:
            type: string
          required: true
          name: fieldId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                viewId:
                  type: string
                  example: viwXXXXXXX
                  description: >-
                    Set the view you want to fetch, default is first view.
                    result will filter and sort by view options.
                filter:
                  type: string
                  description: >-
                    A filter object for complex query conditions based on
                    fields, operators, and values. Use our visual query builder
                    at https://app.teable.ai/developer/tool/query-builder to
                    build filters.
                orderBy:
                  type: string
                  description: >-
                    An array of sort objects that specifies how the records
                    should be ordered.
                groupBy:
                  type: string
                  description: >-
                    An array of group objects that specifies how the records
                    should be grouped.
                ignoreViewQuery:
                  anyOf:
                    - type: string
                    - type: boolean
                  description: >-
                    When a viewId is specified, configure this to true will
                    ignore the view's filter, sort, etc
                mode:
                  type: string
                  enum:
                    - all
                    - emptyOnly
                  default: all
      responses:
        '200':
          description: Returns the task ID for the auto-fill process
          content:
            application/json:
              schema:
                type: object
                properties:
                  taskId:
                    type: string
                    nullable: true
                  rowCount:
                    type: number
                  processedCount:
                    type: number
                  isLimited:
                    type: boolean
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request POST \
              --url https://app.teable.ai/api/table/%7BtableId%7D/field/%7BfieldId%7D/auto-fill \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"viewId":"viwXXXXXXX","filter":"string","orderBy":"string","groupBy":"string","ignoreViewQuery":"string","mode":"all"}'
        - lang: JavaScript
          source: >-
            const url =
            'https://app.teable.ai/api/table/%7BtableId%7D/field/%7BfieldId%7D/auto-fill';

            const options = {
              method: 'POST',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              },
              body: '{"viewId":"viwXXXXXXX","filter":"string","orderBy":"string","groupBy":"string","ignoreViewQuery":"string","mode":"all"}'
            };


            try {
              const response = await fetch(url, options);
              const data = await response.json();
              console.log(data);
            } catch (error) {
              console.error(error);
            }
        - lang: Node.js
          source: |-
            const http = require('https');

            const options = {
              method: 'POST',
              hostname: 'app.teable.ai',
              port: null,
              path: '/api/table/%7BtableId%7D/field/%7BfieldId%7D/auto-fill',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on('data', function (chunk) {
                chunks.push(chunk);
              });

              res.on('end', function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              viewId: 'viwXXXXXXX',
              filter: 'string',
              orderBy: 'string',
              groupBy: 'string',
              ignoreViewQuery: 'string',
              mode: 'all'
            }));
            req.end();
        - lang: Python
          source: >-
            import http.client


            conn = http.client.HTTPSConnection("app.teable.ai")


            payload =
            "{\"viewId\":\"viwXXXXXXX\",\"filter\":\"string\",\"orderBy\":\"string\",\"groupBy\":\"string\",\"ignoreViewQuery\":\"string\",\"mode\":\"all\"}"


            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
            }


            conn.request("POST",
            "/api/table/%7BtableId%7D/field/%7BfieldId%7D/auto-fill", payload,
            headers)


            res = conn.getresponse()

            data = res.read()


            print(data.decode("utf-8"))
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````