> For the complete documentation index, see [llms.txt](https://docs.samesystem.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.samesystem.dev/business-guides/absence/absence-balances.md).

# Absence balances

{% hint style="info" %}
Only available in API v2.
{% endhint %}

SameSystem shows absence balances for each user in the UI as several underlying components, such as:

* Accruals
* Transfers
* Corrections
* Spent
* Expired
* Unpaid

<figure><img src="https://2670147116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRlKDeTWSTdLA0zl6vlB2%2Fuploads%2F5tP2XCUw6obBKWFlZ9Hq%2Fimage.png?alt=media&amp;token=0a205989-36bb-4997-a4cb-cce0496da244" alt=""><figcaption></figcaption></figure>

These underlying values/sub-types are calculated by SameSystem, and they are not stored as static numbers to be updated.

Therefore, it is not possible to directly update individual sub-balances, such as *`Transfers`* or *`Accruals`* as these values does not exist anywhere, but are only calculated.

### How to update the absence absences?

If an update is needed, for example from a Payroll system, the supported integration pattern is to adjust the employee's total available balance by creating an absence balance correction.

<img src="https://2670147116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRlKDeTWSTdLA0zl6vlB2%2Fuploads%2F35Ufmv01Zfmg1vYv1rrp%2Funknown.png?alt=media&amp;token=74d1c48a-cec7-44c1-9802-5f4fb8720a34" alt="" height="343" width="499">

For example:

* SameSystem currently shows **70** vacation days.
* A payroll system calculates that the employee should have **71** vacation days.
* The integration should calculate the difference (**+1 day**) and create an absence balance correction through the absence\_balance\_corrections endpoint: \
  [POST /{clientToken}/absence\_balance\_corrections](/api-v2-reference/absence-balance-corrections/post-client-token-absence-balance-corrections.md)
* SameSystem will then recalculate the total available balance, resulting in **71** available vacation days.

&#x20;

In other words, the integration does not replace the balance. Instead, it adds a correction that adjusts the calculated result.

#### Retrieving the current balance

Before calculating the required correction, the integration needs to retrieve the employee's current absence balance using the User endpoint:

[GET /{clientToken}/users/{id}](/api-v2-reference/users/get-client-token-users-id.md)

The current available balance is returned as either:

* `available`\
  When the balance is represented in days.
* `availableHours`\
  When the balance is represented in hours.

The applicable field depends on the absence type's configured Unit.

#### Summary

The integration should follow this process:

{% stepper %}
{% step %}

### Get the current absence balance

Retrieve the employee's current available absence balances.
{% endstep %}

{% step %}

### Compare balances and find differences

Compare balances from SameSystem with the balances calculated by your payroll system. Calculate the differences.
{% endstep %}

{% step %}

### Create a absence balance correction

Create an absence balance corrections representing that difference in each absence balance (+/-).
{% endstep %}

{% step %}

### Automatically recalculations

SameSystem recalculates the final available balance automatically.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.samesystem.dev/business-guides/absence/absence-balances.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
