# How to return an API response from a destination

**URL:** <https://community.synatic.com/t/how-to-return-an-api-response-from-a-destination/403>\
**Category:** Flows\
**Tags:** flows, api, connection\
**Created:** [January 29, 2024, 11:25am UTC](https://community.synatic.com/t/how-to-return-an-api-response-from-a-destination/403 "2024-01-29T11:25:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faizel](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.synatic.com/faizel/32/918_2.png) [@Faizel](https://community.synatic.com/u/Faizel)\
**Post date:** [January 29, 2024, 11:25am UTC](https://community.synatic.com/t/how-to-return-an-api-response-from-a-destination/403/1 "2024-01-29T11:25:23Z")

</div>

If required to use an API that requires a body to be sent and a response to be received, please follow the instructions below:

Illustrated in the image below is an example of a flow that prepares a JSON body to send to an API and retrieve the response back from the endpoint then saves the data into a buffer. In this example, the flow takes a food category in the form of a body request and then passes it to an API which returns a list of meal options, including the protein and fat of the meal.

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/2X/5/5ed26e43a8f28af76c25c416d69ab220b612718c.png)

In this example, a Start Flow source step is used as per the image below.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/2X/5/58d061c8582e9e0986c2c190e35b2507f73bb052.png)

Add a Calculator step after the source step. The below image is an example of the body response to send to the API.

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/2X/8/8f148846958dde9996efede67a9020813e535ff5.png)

In the HTTP Service destination step, specify the URL, select any connections if required, and any other configuration required by the API as illustrated in the image below.

**Note: Response Encoding is used to encode the response from the API, When working with files Response Encoding can be set to Binary.**

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/2X/b/beaba45dee8c4e22dc8128721d1349dd22b3dff9.png)

After the HTTP Service destination step, add a Calculator and change `input.record` to `input.result` as per the image below. This will return the result from the API if a response can be returned from the API.

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/2X/9/9502093b34a12def2bee80d50ac18737f2ad3295.png)

When testing a destination step, uncheck the Disable Destination Steps options to show the response from the HTTP Service in Synatic Step Debug window as per the image below.

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/2X/b/b9d97621b49779e5adadb21d9a8e2d67f023b592.png)

When the flow is executed, the buffer will be populated as per the image below.

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/2X/9/9aa3d992bd28a8d42c2cdd01f57e3dbf93420b04.png)
