# Task Service

Do you need some custom logic in your medical backend? Run custom code in a certified environment using the Task Service. The Task Service is well-integrated with the [Data Service](https://docs.extrahorizon.com/extrahorizon/manage-data/data-service#intro) to automatically act upon changes in your database. It can as well be used to run standalone business logic asynchronously, synchronous or on a schedule.

Some common use cases where you can leverage the Task Service include:

* **Data Processing**\
  When a new device measurement comes in, a task can be triggered to asynchronously process the measurement data. This task can make third-party API calls to augment the measurement.
* **Data synchronization**\
  To synchronize data between Extra Horizon other systems, a task can be created. This task can run on a schedule or can be triggered by an event.
* **GDPR-compliant user management**\
  When a user is deleted from the system, a task can be triggered that uses the API of a third-party system to delete the user's data in that system as well.
* **Daily reporting**\
  Run a reporting task to aggregate data from the data service into a daily report.
* **Creating custom endpoints**\
  An API Function can be used to create custom endpoints, enabling an IoT Device to perform simple HTTP requests to push, process and synchronize data.

## Functions & Tasks

The task service has two logical entities: functions and tasks.

A **function** contains the business logic, the code that you want to execute.

{% content-ref url="task-service/functions" %}
[functions](https://docs.extrahorizon.com/extrahorizon/services/automation/task-service/functions)
{% endcontent-ref %}

A **task** is represents the execution of a function with a set of inputs.

{% content-ref url="task-service/tasks" %}
[tasks](https://docs.extrahorizon.com/extrahorizon/services/automation/task-service/tasks)
{% endcontent-ref %}

### Functions and tasks

Functions and tasks are the two main concepts in this service.

A **function** is the single unit of code that can be executed within the executable piece of code that an executable

A **task** represents the execution of a specific function.

### 🔗 More Resources

{% embed url="<https://www.youtube.com/watch?v=ncOFiA5lrRE>" %}

## Resources & References

* [Task service changelog](https://docs.extrahorizon.com/extrahorizon/api-reference/changelog-chronological/changelog-service#tasks-service)
* [API Specifications](https://docs.extrahorizon.com/extrahorizon/api-reference/api-specs)

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.extrahorizon.com/extrahorizon/services/automation/task-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
