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

# Delete data

> Deletes one record.

**Records that link here.** While a record of another data type links to this one through a `belongsTo` or `belongsToMany` field, the delete is refused with `400`, `failedCode` `data-032`, and the linking records grouped by data type under `referencedBy`. Send `force=true` to delete anyway and clear those links. v3 has no such check.

A record of an external data source is read-only (`failedCode` `data-032`). While the record's data type is being prepared or registering unique values, writes answer `409` with `failedCode` `dtype-036`.

Requires permission `delete/data`.



## OpenAPI

````yaml /openapi/public/openapi-data.json delete /data/{data_id}/
openapi: 3.0.0
info:
  title: API - Data
  version: 3.0.0
  description: API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Data Source
    description: >-
      The Data source could help you simplify the process of filling in task
      information based on existing data in the app. This data could consist of
      information such as name, number, date, coordinate, and multiple options.
      The Data typically represents entities such as customers, products,
      employees, suppliers, or any other critical data elements that are used
      across the application.


      **To see the details of data source object, please follow [this
      link](#tag/data_source_model)**
  - name: Data Type
    description: >-
      The Data type is the structure of data fields that is customizable to suit
      your business needs. Data type attributes consist of IDs, name, field
      details, type, and primary key. This data type structure will be used at
      Data Source and Flow.


      **To see the details of data type object, please follow [this
      link](#tag/data_type_model)**
paths:
  /data/{data_id}/:
    delete:
      tags:
        - Data Source
      summary: Delete data
      description: >-
        Deletes one record.


        **Records that link here.** While a record of another data type links to
        this one through a `belongsTo` or `belongsToMany` field, the delete is
        refused with `400`, `failedCode` `data-032`, and the linking records
        grouped by data type under `referencedBy`. Send `force=true` to delete
        anyway and clear those links. v3 has no such check.


        A record of an external data source is read-only (`failedCode`
        `data-032`). While the record's data type is being prepared or
        registering unique values, writes answer `409` with `failedCode`
        `dtype-036`.


        Requires permission `delete/data`.
      operationId: deleteDataById
      parameters:
        - name: _id
          in: path
          required: true
          description: |-
            Unique identifier for the data that generated by system.
            **Example**: `63dc641b1ed1fd63ad0c9013`
          schema:
            type: string
        - name: force
          in: query
          required: false
          description: >-
            Delete even when other records link to this one through a relation
            field; their links to it are cleared.
          schema:
            type: boolean
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                title: NetworkDeleteResponse
                properties:
                  status:
                    type: boolean
                    description: Status of response.
                  data:
                    description: Detail of object data source.
                    type: object
                    additionalProperties: true
                example:
                  status: true
                  data:
                    _id: 63dc641b1ed1fd63ad0c9013
                    dataId: Outlet
                    dataTypeId: 63db2fb476bc679c540369c4
                    outletName: Cabang Jakarta Pusat
                    outletHours: 12
                    outletType: minimarket
                    outletOpen: '09:00'
                    outletClosed: '17:00'
                    outletContractExpired: '2023-02-02'
                    outletOpenInWeekend: true
                    outletGeolocation: '-6.171702325136309,106.81775093078615'
                    outletPhoneNumber: +62 123 456 789
                    outletCloseOrder: '2023-02-02 17:00:00'
                    hubId: 63c63ab1b6972d3150348172
                    organizationId: 63c61d865347e356d05e3052
                    createdBy: john.doe@example.com
                    updatedTime: '2023-02-03 01:32:11'
                    createdTime: '2023-02-03 01:32:11'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '409':
          description: >-
            Conflict: the data type is being prepared or a file import into it
            is running
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Internal server error, please contact support@mile.app.
      deprecated: false
      security:
        - bearerAuth: []
      servers:
        - url: https://apiweb.mile.app/api/v4
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.