Skip to main content
 print this page

Delete a training document, or one of its uploaded files

DELETE 

/nl2sql/training-documents/:id

Deletes either a single uploaded file or the whole training document, depending on whether file_name is supplied.

  • With file_name: deletes just that file and its metadata, synchronously.
  • Without file_name: starts asynchronous deletion of the entire document. A 200 means deletion was triggered, not that it has completed, and failures during the asynchronous phase are never reported to the caller.

Deleting training data does not immediately change the chatbot's answers: run POST /nl2sql/sync-jobs to propagate the removal to the knowledge base.

Requires SQLAI to be present in the environment's enabled AI services; otherwise the request fails with AI-1004.

Two backend defects are worth knowing about when calling this operation. Deleting a document id that does not exist returns HTTP 500 rather than the documented 400, because the handler dereferences the record before checking whether it was found. Supplying a file_name that the document does not contain also returns HTTP 500, and its message carries no error-code prefix, unlike every other error on this API.

Request

Responses

File deleted, or whole-document deletion triggered. The message distinguishes the two.

Response Headers
    Access-Control-Allow-Origin
    Access-Control-Allow-Methods
    Access-Control-Allow-Headers