> For the complete documentation index, see [llms.txt](https://docs.coherent.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coherent.global/build-spark-services/call-spark-service-apis.md).

# Call Spark service APIs (Xcall)

## Introduction

By connecting Spark services together, users can use data from different sources and to better externalize calculations and data. The `Xcall` has 2 parts, the `Xcall` block to define the request, and a user-defined function, to receive responses. Multiple `Xcall`s can be included in a single Spark Service.

## Prerequisites

* Two Spark services are required. One is upstream, to make an API request and receive a response. The other one is downstream, to give an API response depending on the request from upstream.
* [Coherent Assistant](https://docs.coherent.global/assistant/) is required to help build the `CS.SPARK_XCALL()` user-defined function to connect the two services through a native Excel function.
* Both Spark services must be uploaded under the same tenant and accessible with the same credentials.

<figure><img src="/files/kIkyVowuCcfEiCW6cu3c" alt=""><figcaption><p>XCall: Flow of Data</p></figcaption></figure>

### Downstream Service

This is a usual Spark service that provides data to the upstream service when an `Xcall` is executed in the upstream service. This file will contain usual `Xinput`s and `Xoutput`s which will be used as parameters when called from the upstream service. This file would not contain any custom/user-defined functions.

### Upstream Service

This Spark service uses `Xcall` to call an API to get data from the downstream service by passing the necessary parameters. The Excel file for this service would contain the `Xcall` block as well as custom/user-defined functions to execute the API call.
