> For the complete documentation index, see [llms.txt](https://kb.stoque.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.stoque.com.br/zeev/apis/all/access/temporary-leave.md).

# Ausência temporária

## Como ativar/desativar ausência temporária para uma pessoa utilizando API?

Para ativar o modo [ausência temporária](/zeev/dia-a-dia/como-configurar-um-substituto-em-periodo-de-ausencia.md#o-que-ocorre-quando-voce-esta-ausente) para uma pessoa utilizando API, siga os passos abaixo:

1. **Autenticação**: Primeiro obtenha um [token de autenticação](https://kb.zeev.it/apis/como-gerar-tokens-para-autenticar-nas-apis) com permissão de realizar essa operação;
2. **Obtenha o userid:** Obtenha código do usuário. É possível obter este identificador na página Acesso > Pessoas ou utilizando consulta de API's como nos exemplos que estão disponíveis em [Listar pessoas](/zeev/apis/all/access/people/list.md);
3. **Para ativar o modo ausência temporária:** Defina o período de ausência e utilize o endpoint [#api-2-users-userid-absent-enter](#api-2-users-userid-absent-enter "mention") (troque seu\_endereco.do.zeev pelo endereço que você usa para acessar o Zeev);
4. **Para desativar o modo ausência temporária:** Utilize o endpoint [#api-2-users-userid-absent-leave](#api-2-users-userid-absent-leave "mention")(troque seu\_endereco.do.zeev pelo endereço que você usa para acessar o Zeev);

{% openapi src="/files/DYIxvabeLXa2mL6uE2si" path="/api/2/users/{userid}/absent/enter" method="patch" %}
[ZeevApi's\_new.json](https://3371003943-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MD66pBdRalAQgnhNstG%2Fuploads%2Ff5huLIsAqm88oSjkTavv%2FZeevApi's_new.json?alt=media\&token=aae47f9f-90ca-48d0-b250-fc38fe74e6c0)
{% endopenapi %}

Exemplo de requisição para ativar ausência temporária

{% tabs %}
{% tab title="Node.js" %}

```javascript
let userId = 486;
let absenceBegin = "2024-01-02T18:00:00.000Z"
let absenceEnd = "2024-02-01T09:00:00.000Z"

const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer TOKEN_DO_USUARIO");

const raw = JSON.stringify({
  "absenceStartDate": abscenceBegin,
  "absenceEndDate": abscenceEnd
});

const requestOptions = {
  method: "PATCH",
  headers: myHeaders,
  body: raw
};

try {
  const response = await fetch(`https://seu_endereco.do.zeev/api/2/users/${userId}/absent/enter`, requestOptions);
  const result = await response.json();
  console.log(result)
} catch (error) {
  console.error(error);
};
```

{% endtab %}
{% endtabs %}

{% openapi src="/files/DYIxvabeLXa2mL6uE2si" path="/api/2/users/{userid}/absent/leave" method="patch" %}
[ZeevApi's\_new.json](https://3371003943-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MD66pBdRalAQgnhNstG%2Fuploads%2Ff5huLIsAqm88oSjkTavv%2FZeevApi's_new.json?alt=media\&token=aae47f9f-90ca-48d0-b250-fc38fe74e6c0)
{% endopenapi %}

Exemplo de requisição para desativar ausência temporária

{% tabs %}
{% tab title="JavaScript" %}

```javascript
let userId = 486;

const myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer TOKEN_DO_USUARIO");

const requestOptions = {
  method: "PATCH",
  headers: myHeaders
};

try {
  const response = await fetch(`https://seu_endereco.do.zeev/api/2/users/${userId}/absent/leave`, requestOptions);
  const result = await response.text();
  console.log(result)
} catch (error) {
  console.error(error);
};
```

{% endtab %}
{% endtabs %}

***

## **Links relacionados**:

* [O que é preciso para fazer integrações do Zeev para outros sistemas?](/zeev/integracoes/o-que-e-preciso-para-fazer-integracoes.md)
* [Como autenticar nas APIs do Zeev](/zeev/apis/como-utilizar-as-apis-do-zeev/como-gerar-tokens-para-autenticar-nas-apis.md)
* [Como controlar o volume máximo de requisições à APIs](/zeev/apis/como-utilizar-as-apis-do-zeev/como-controlar-o-volume-maximo-de-requisicoes-a-apis.md)
* [Como acessar o Swagger / OpenAPI](/zeev/apis/como-utilizar-as-apis-do-zeev/como-acessar-o-swagger-openapi.md)
* [Como configurar um substituto](/zeev/dia-a-dia/como-configurar-um-substituto-em-periodo-de-ausencia.md)


---

# 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://kb.stoque.com.br/zeev/apis/all/access/temporary-leave.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.
