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

# Post adminobservabilitytable query opsrecommendationsaccept

> Accept a Table Query Ops recommendation and enqueue its index task

Required token scopes: `instance|update`



## OpenAPI

````yaml /swagger.json post /admin/observability/table-query-ops/recommendations/accept
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: []
tags:
  - name: base
    x-group: project
  - name: base node
    x-group: project node
  - name: base-share
    x-group: project-share
paths:
  /admin/observability/table-query-ops/recommendations/accept:
    post:
      tags:
        - admin
        - observability
      description: |-
        Accept a Table Query Ops recommendation and enqueue its index task

        Required token scopes: `instance|update`
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                recommendationId:
                  type: string
                  minLength: 1
                execute:
                  type: boolean
              required:
                - recommendationId
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  recommendation:
                    type: object
                    properties:
                      id:
                        type: string
                      spaceId:
                        type: string
                        nullable: true
                      baseId:
                        type: string
                      tableId:
                        type: string
                      spaceName:
                        type: string
                        nullable: true
                      baseName:
                        type: string
                      tableName:
                        type: string
                      executionTarget:
                        type: object
                        properties:
                          storage:
                            type: string
                            enum:
                              - default
                              - byodb
                          displayHost:
                            type: string
                          displayDatabase:
                            type: string
                          internalSchema:
                            type: string
                        required:
                          - storage
                      shapeHash:
                        type: string
                      policyVersion:
                        type: string
                      status:
                        type: string
                        enum:
                          - open
                          - accepted
                          - dismissed
                          - superseded
                      riskLevel:
                        type: string
                        enum:
                          - none
                          - low
                          - medium
                          - high
                          - critical
                      riskScore:
                        type: number
                      reasonCodes:
                        type: array
                        items:
                          type: string
                      remediationKinds:
                        type: array
                        items:
                          type: string
                      remediationCandidates:
                        type: array
                        items:
                          type: object
                          properties:
                            kind:
                              type: string
                            reason:
                              type: string
                            executableInPhase1:
                              type: boolean
                            fieldId:
                              type: string
                            fieldDbName:
                              type: string
                            indexKind:
                              type: string
                            accessPath:
                              type: string
                            fields:
                              type: array
                              items:
                                type: object
                                properties:
                                  fieldId:
                                    type: string
                                  fieldDbName:
                                    type: string
                                  direction:
                                    type: string
                                    enum:
                                      - asc
                                      - desc
                                  role:
                                    type: string
                          required:
                            - kind
                            - reason
                            - executableInPhase1
                      trigger:
                        type: object
                        properties:
                          sourceKind:
                            type: string
                            enum:
                              - saved_view_config
                              - runtime_observation
                              - relation_field_config
                              - unknown
                          sourceId:
                            type: string
                          viewId:
                            type: string
                          fingerprint:
                            type: string
                          observedWorkload:
                            type: boolean
                        required:
                          - sourceKind
                          - observedWorkload
                      shapeSummary:
                        type: object
                        properties:
                          filterFields:
                            type: array
                            items:
                              type: object
                              properties:
                                fieldId:
                                  type: string
                                operatorFamily:
                                  type: string
                                sourceKind:
                                  type: string
                              required:
                                - fieldId
                                - operatorFamily
                          sortFields:
                            type: array
                            items:
                              type: object
                              properties:
                                fieldId:
                                  type: string
                                systemColumn:
                                  type: string
                                direction:
                                  type: string
                                  enum:
                                    - asc
                                    - desc
                                source:
                                  type: string
                              required:
                                - direction
                                - source
                          search:
                            type: object
                            properties:
                              fieldCount:
                                type: number
                              allFields:
                                type: boolean
                              valueLengthBucket:
                                type: string
                            required:
                              - fieldCount
                              - allFields
                              - valueLengthBucket
                        required:
                          - filterFields
                          - sortFields
                      queryKind:
                        type: string
                      sqlDiagnostics:
                        type: array
                        items:
                          type: object
                          properties:
                            source:
                              type: string
                            statementKind:
                              type: string
                            fingerprint:
                              type: string
                            parameterCount:
                              type: number
                            sampled:
                              type: boolean
                            normalizedSql:
                              type: string
                          required:
                            - source
                            - statementKind
                            - fingerprint
                            - parameterCount
                            - sampled
                      planValidation:
                        type: object
                        properties:
                          status:
                            type: string
                            enum:
                              - validated
                              - skipped
                              - failed
                          method:
                            type: string
                            enum:
                              - explain
                              - hypothetical_index
                          reason:
                            type: string
                          candidateCount:
                            type: number
                          startupCostBefore:
                            type: number
                          startupCostAfter:
                            type: number
                          totalCostBefore:
                            type: number
                          totalCostAfter:
                            type: number
                          planNodeBefore:
                            type: string
                          planNodeAfter:
                            type: string
                          usesCandidateIndex:
                            type: boolean
                          indexStatements:
                            type: array
                            items:
                              type: string
                          errors:
                            type: array
                            items:
                              type: string
                        required:
                          - status
                          - candidateCount
                      createdTime:
                        type: string
                      lastModifiedTime:
                        type: string
                      priorityScore:
                        type: number
                      heat:
                        type: object
                        properties:
                          requestCount:
                            type: number
                          slowCount:
                            type: number
                          timeoutCount:
                            type: number
                          totalDurationMs:
                            type: number
                          maxDurationMs:
                            type: number
                          estimatedRows:
                            type: number
                            nullable: true
                          seqScanCount:
                            type: number
                          indexScanCount:
                            type: number
                        required:
                          - requestCount
                          - slowCount
                          - timeoutCount
                          - totalDurationMs
                          - maxDurationMs
                          - estimatedRows
                      decision:
                        type: object
                        properties:
                          action:
                            type: string
                            enum:
                              - auto_accept
                              - hold
                              - reclaim
                              - noop
                          actor:
                            type: string
                            enum:
                              - system_policy
                              - admin
                          outcome:
                            type: string
                            enum:
                              - pending
                              - executed
                              - post_verify_failed
                              - skipped
                          wouldAutoAccept:
                            type: boolean
                          reasonCodes:
                            type: array
                            items:
                              type: string
                          cooldownUntil:
                            type: string
                          decidedAt:
                            type: string
                        required:
                          - action
                          - actor
                          - outcome
                          - wouldAutoAccept
                          - reasonCodes
                    required:
                      - id
                      - spaceId
                      - baseId
                      - tableId
                      - executionTarget
                      - shapeHash
                      - policyVersion
                      - status
                      - riskLevel
                      - riskScore
                      - reasonCodes
                      - remediationKinds
                      - sqlDiagnostics
                      - priorityScore
                  task:
                    type: object
                    properties:
                      id:
                        type: string
                      recommendationId:
                        type: string
                        nullable: true
                      baseId:
                        type: string
                      tableId:
                        type: string
                      baseName:
                        type: string
                      tableName:
                        type: string
                      kind:
                        type: string
                      status:
                        type: string
                        enum:
                          - queued
                          - running
                          - succeeded
                          - failed
                          - cancelled
                      attempts:
                        type: number
                      maxAttempts:
                        type: number
                      lockedBy:
                        type: string
                        nullable: true
                      lockedAt:
                        type: string
                        nullable: true
                      lastError:
                        type: string
                        nullable: true
                      result:
                        nullable: true
                      createdTime:
                        type: string
                      lastModifiedTime:
                        type: string
                    required:
                      - id
                      - recommendationId
                      - baseId
                      - tableId
                      - kind
                      - status
                      - attempts
                      - maxAttempts
                required:
                  - recommendation
                  - task
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request POST \
              --url https://app.teable.ai/api/admin/observability/table-query-ops/recommendations/accept \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"recommendationId":"string","execute":true}'
        - lang: JavaScript
          source: >-
            const url =
            'https://app.teable.ai/api/admin/observability/table-query-ops/recommendations/accept';

            const options = {
              method: 'POST',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              },
              body: '{"recommendationId":"string","execute":true}'
            };


            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/admin/observability/table-query-ops/recommendations/accept',
              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({recommendationId: 'string', execute:
            true}));

            req.end();
        - lang: Python
          source: >-
            import http.client


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


            payload = "{\"recommendationId\":\"string\",\"execute\":true}"


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


            conn.request("POST",
            "/api/admin/observability/table-query-ops/recommendations/accept",
            payload, headers)


            res = conn.getresponse()

            data = res.read()


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

````