--- title: "Using Throw API Exception Step" slug: "using-throw-api-exception-step" updated: 2023-08-28T14:41:29Z published: 2023-08-28T14:41:29Z canonical: "documentation.decisions.com/using-throw-api-exception-step" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt > Use this file to discover all available pages before exploring further. # Using Throw API Exception Step Example Lab ArticleWhile Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released. --- ## Overview | ## Example Lab Details | | --- | | **Version** | 6.12.1 | | **Root Folder** | Example Lab - API Exception | | **Modules** | None | | **Dependencies** | None | This Example Lab project demonstrates how to use the Throw API Exception Step --- ## Explanation This Flow has one input of the type Integer. This input is passed to an Equals (Number) Rule that checks if it is equal to 1. If it is the Flow completes. If it's not, the flow goes to the Throw API Exception Step, which throws an exception with the message "wrong number, try 1" and code 400. If this Flow as called as a REST service, this code and message are what is returned. The message and status code can be set on the step to customize how a Flow returns errors when called as a REST service. Reference Articles[Calling a Flow as a REST Service](https://documentation.decisions.com/docs/rest-handling-services) ![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image-1604086318812.png) --- ## Project Download The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production-quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 6.12.1 or later using our [Importing/Exporting](https://documentation.decisions.com/docs/importing-and-exporting-projects) article. [ExampleLab[APIException].zip](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/ExampleLab%5BAPIException%5D.zip) ---