The encryption and signature standards proposed by W3C specifying the format for encrypted XML documents are important advances towards XML security [4,7]. Related works include the proposal of a specification language that allows a programmer to describe the security details of XML documents [3,8]. Despite the success of these works, we consider them to be insufficient from the viewpoint of software engineering. In this paper, we employ some real examples to demonstrate that it is necessary to design an appropriate API for the securing system of subtree encryption for XML documents. The goal is to increase productivity and reduce the cost of maintaining this kind of software, for which we propose a document security language (DSL) API. We describe the implementation of the DSL API, and use experimental results to demonstrate its practicality.