---
title: "Create a validated absence 🌍"
method: POST
path: "/companies/{companyId}/absences"
tags: ["Absences"]
---

# Create a validated absence 🌍

`POST /companies/{companyId}/absences`

## Request

- Base URL: `https://partner-api.payfit.com`
- URL: `https://partner-api.payfit.com/companies/{companyId}/absences`
- Auth: OAuth 2
  - Authorization code: `https://oauth.payfit.com/authorize`
  - Token URL: `https://oauth.payfit.com/token` scopes: `time:write`
- TypeScript: <https://skmtc.dev/payfit/apis/partner-api/docs/companies/:companyId/absences/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a validated absence for a collaborator in a company and returns the new absence ID.

\
**Required scopes**: *time:write*

## Path parameters

- `companyId` string, required

## Request body

- object
  - `contractId` string, required: Contract ID of the absence owner.
  - `type` 'fr_conges_payes' | 'fr_rtt' | 'fr_repos' | 'fr_sans_solde' | 'fr_teletravail' | 'fr_ecole' | 'fr_maladie_ordinaire' | 'fr_mariage_salarie' | 'fr_pacs_salarie' | 'fr_mariage_enfant' | 'fr_mariage_frere_ou_soeur' | 'fr_mariage_beau_frere_ou_belle_soeur' | 'fr_mariage_ascendant' | 'fr_mariage_petit_enfant' | 'fr_deces_beau_pere_ou_belle_mere' | 'fr_deces_conjoint' | 'fr_deces_enfant' | 'fr_deces_frere_ou_soeur' | 'fr_deces_grand_parent' | 'fr_deces_pere_ou_mere' | 'fr_deces_beau_frere_ou_belle_soeur' | 'fr_deces_gendre_ou_belle_fille' | 'fr_deces_petit_enfant' | 'fr_demenagement' | 'fr_echographie_prenatale' | 'fr_conjoint_malade_ou_hospitalise' | 'fr_handicap_enfant' | 'fr_examen_professionnel_formation_continue' | 'fr_appel_preparation_defense' | 'fr_ceremonie_enfant_communion_solennelle' | 'fr_demarches_adoption' | 'es_huelga' | 'es_permiso_por_convenio_no_remunerado' | 'es_permiso_parental' | 'es_vacaciones' | 'es_teletrabajo' | 'es_descanso_horas_extras' | 'es_descanso_por_festivo_trabajado' | 'es_visita_medica' | 'es_permiso_por_matrimonio' | 'es_deber_inexcusable' | 'es_examenes_prenatales' | 'es_tecnicas_de_preparacion_al_parto' | 'es_adopcion' | 'es_mudanza' | 'es_permiso_por_examenes' | 'es_permiso_por_formacion' | 'es_asuntos_propios' | 'es_jornada_de_licencia' | 'es_lactancia_acumulada' | 'es_prematuros_hospitalizados' | 'es_permiso_especial_fuerza_mayor' | 'es_otro_asunto_personal' | 'es_fallecimiento_pariente_de_primer_grado_de_consanguinidad' | 'es_fallecimiento_pariente_de_segundo_grado_de_consanguinidad' | 'es_hospitalizacion_de_un_familiar' | 'es_intervencion_quirurgica_sin_hospitalizacion' | 'es_accidente_o_enfermedad_grave' | 'es_permiso_asistencia_a_matrimonio' | 'es_fallecimiento_pariente_de_tercer_grado_de_consanguinidad' | 'es_otro_asunto_familiar' | 'es_permiso_por_horas' | 'uk_annual_leave' | 'uk_remote' | 'uk_sick_leave' | 'uk_unpaid_leave' | 'uk_compassionate_leave' | 'uk_custom_leave_1' | 'uk_custom_leave_2' | 'uk_custom_leave_3' | 'uk_custom_leave_4' | 'uk_custom_leave_5', required: Type of absence to create.
  - `startDate` object, required: Date and moment of the day when the absence starts.
    - `date` string, date, required: Date of the absence in the format YYYY-MM-DD.
    - `moment` 'beginning-of-day' | 'middle-of-day' | 'end-of-day', required: Moment of the day when the absence starts.
  - `endDate` object, required: Date and moment of the day when the absence ends.
    - `date` string, date, required: Date of the absence in the format YYYY-MM-DD.
    - `moment` 'beginning-of-day' | 'middle-of-day' | 'end-of-day', required: Moment of the day when the absence ends.

## Response `201`

The absence was created.

- object
  - `id` string, required: ID of the created absence.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found

---

[API](https://skmtc.dev/payfit/apis/partner-api.md) - [All operations](https://skmtc.dev/payfit/apis/partner-api/llms.txt) - [OpenAPI document](https://skmtc.dev/payfit/apis/partner-api/revisions/4ad2186afd5e?raw)
