URL:
https://<knowledgegraphserver_graph-url>/truncate
Methods:
POST
Version Introduced:
12.2

Description

The truncate operation is performed on a knowledge service's /graph resource. This operation allows users to permanently remove graph data from a knowledge graph service. It is designed to efficiently delete large volumes of data without requiring clients to first enumerate and delete individual entities or relationships. It can be used to remove all entities and relationships associated with a specific named type, or to remove all data in the graph, while preserving the data model.

The truncate operation is strictly asynchronous, where multiple truncate requests may run concurrently given each request is for a mutually exclusive named type. In the event multiple requests are operating on not mutually exclusive types, or if provenance is enabled, the requests are serialized.

Additionally, given that the asynchronous truncate operation and the synchronous applyEdits operation are both performed on the knowledge service's graph resource, conflicts may occur depending on the timing of each request. As a result, the incoming operation request will fail when a conflicting operation is in progress. For example, if a truncate operation is in progress, any applyEdits request will be rejected.

Administrative clients and owners of the knowledge graph service can always perform this operation. The user must have sufficient privileges to edit content and editing must be enabled for the knowledge graph service for this operation to be successful. You can enable editing for a knowledge graph service in the same way that you enable it for a hosted feature layer. The knowledge graph service's strict property must not be set to true, which indicates the data model cannot be modified.

The truncate operation is not supported for a knowledge graph service with the sync feature enabled.

Request parameters

ParameterDetails

truncate_option

(Required)

The data associated with a single named type, or all graph data, to be deleted.

f

The response format. The default format is html.

Values: pbf | html

Example workflow

Below is a sample workflow to truncate all entities from the entity type ExampleEntityType1 from a knowledge graph service named SupplyChain using html responses:

  1. Submit a truncate job using a request URL:

    Use dark colors for code blocksCopy
    1
    https://organization.example.com/<context>/rest/services/Hosted/SupplyChain/KnowledgeGraphServer/graph/truncate?f=html
  2. Access the job status URL:

    Use dark colors for code blocksCopy
    1
    https://organization.example.com/<context>/rest/services/Hosted/SupplyChain/KnowledgeGraphServer/jobs/<jobId>/status?f=html
  3. When the job is completed successfully, the resultsUrl can be used to access the job results.

    Use dark colors for code blocksCopy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    resultsUrl: https://organization.example.com/<context>/rest/services/Hosted/SupplyChain/KnowledgeGraphServer/jobs/<jobId>/results?f=html
    asyncStatus: ASYNC_STATUS_COMPLETED
    progressStatus:
      code: 114716
      message: Completed truncating the entity or relationship type 'ExampleEntityType1'.
    messages:
      EXECUTING
      starttime: 2026-08-27T20:21:37.623375010Z
      EXECUTING
      starttime: 2026-08-27T20:21:37.626499802Z
      Started truncating the entity or relationship type 'ExampleEntityType1'.
      Cascade deleting relationship type: 'Related_to'.
      Cascade deleted relationships in 'Related_to': 1.
      Completed truncating the entity or relationship type 'ExampleEntityType1'.
      COMPLETED
      endtime: 2026-08-27T20:21:37.669Z
    lastUpdatedTime: 1787862097669
    submissionTime: 1787862097625
  4. View job results for the completed truncate operation:

    Use dark colors for code blocksCopy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    completionTime: 1787862097669
    truncateResult:
    statistics:
      ExampleEntityType1:
      deletedCount: 5
      typeCategory: esriTypeEntity
      Related_to:
      cascadeDeleted: true
      deletedCount: 1
      typeCategory: esriTypeRelationship
    submissionTime: 1787862097623

Requests and responses

This operation can also be performed by sending a PBF-formatted request and receiving a PBF-formatted response. The status of the operation can be queried using a PBF-formatted response. Details of the request and response parameters are provided in the appropriate .proto files.

PBF Request

Create a PBF-formatted request to perform this operation based on the TruncateRequest.proto file.

PBF Response

Create a PBF-formatted response to query the status of the operation based on the AsyncStatusResponse.proto file.

Once the operation is complete, get the truncate results using the results_url in the PBF-formatted response based on the TruncateResponse.proto file.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.