---
updatedAt: 2026-06-29T09:41:37.000Z
agentTools:
  projectIndex: https://developers.payfit.io/llms.txt
---

# Create a validated absence 🌍

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

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

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Partner API",
    "description": "An API to let third parties communicate with PayFit",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://partner-api.payfit.com",
      "description": "The PayFit API production server"
    }
  ],
  "paths": {
    "/companies/{companyId}/absences": {
      "post": {
        "operationId": "POST_absences",
        "summary": "Create a validated absence 🌍",
        "description": "Creates a validated absence for a collaborator in a company and returns the new absence ID.\n\n\\\n**Required scopes**: *time:write*",
        "tags": [
          "Absences"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "companyId",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "The id of the company"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "title": "createAbsenceRequest",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "contractId": {
                    "type": "string",
                    "description": "Contract ID of the absence owner.",
                    "example": "5b59e7b282ddef55f860d322"
                  },
                  "type": {
                    "type": "string",
                    "description": "Type of absence to create.",
                    "x-enum-name": "CreateAbsenceType",
                    "enum": [
                      "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"
                    ]
                  },
                  "startDate": {
                    "type": "object",
                    "description": "Date and moment of the day when the absence starts.",
                    "additionalProperties": false,
                    "properties": {
                      "date": {
                        "type": "string",
                        "format": "date",
                        "description": "Date of the absence in the format YYYY-MM-DD.",
                        "example": "2026-07-01"
                      },
                      "moment": {
                        "type": "string",
                        "description": "Moment of the day when the absence starts.",
                        "enum": [
                          "beginning-of-day",
                          "middle-of-day",
                          "end-of-day"
                        ]
                      }
                    },
                    "required": [
                      "date",
                      "moment"
                    ]
                  },
                  "endDate": {
                    "type": "object",
                    "description": "Date and moment of the day when the absence ends.",
                    "additionalProperties": false,
                    "properties": {
                      "date": {
                        "type": "string",
                        "format": "date",
                        "description": "Date of the absence in the format YYYY-MM-DD.",
                        "example": "2026-07-02"
                      },
                      "moment": {
                        "type": "string",
                        "description": "Moment of the day when the absence ends.",
                        "enum": [
                          "beginning-of-day",
                          "middle-of-day",
                          "end-of-day"
                        ]
                      }
                    },
                    "required": [
                      "date",
                      "moment"
                    ]
                  }
                },
                "required": [
                  "contractId",
                  "type",
                  "startDate",
                  "endDate"
                ]
              },
              "examples": {
                "absence": {
                  "summary": "An example of absence creation",
                  "value": {
                    "contractId": "5b59e7b282ddef55f860d322",
                    "type": "fr_conges_payes",
                    "startDate": {
                      "date": "2026-07-01",
                      "moment": "beginning-of-day"
                    },
                    "endDate": {
                      "date": "2026-07-02",
                      "moment": "end-of-day"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The absence was created.",
            "content": {
              "application/json": {
                "schema": {
                  "title": "createAbsenceResponse",
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "ID of the created absence.",
                      "example": "123456789"
                    }
                  },
                  "required": [
                    "id"
                  ]
                },
                "examples": {
                  "absence": {
                    "summary": "An example of created absence response",
                    "value": {
                      "id": "5f9b03f75a18101bd958591e"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "title": "error",
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A human readable error"
                    },
                    "details": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": true
                        },
                        {
                          "type": "string",
                          "additionalProperties": true
                        }
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "An example of an error message",
                    "value": {
                      "code": 400,
                      "error": "Bad request",
                      "details": "Field \"id\" is required."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "title": "error",
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A human readable error"
                    },
                    "details": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": true
                        },
                        {
                          "type": "string",
                          "additionalProperties": true
                        }
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "An example of an error message",
                    "value": {
                      "code": 401,
                      "error": "Unauthorized"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "title": "error",
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A human readable error"
                    },
                    "details": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": true
                        },
                        {
                          "type": "string",
                          "additionalProperties": true
                        }
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "An example of an error message",
                    "value": {
                      "code": 403,
                      "error": "Forbidden action",
                      "details": "Missing scope \"contracts:read\"."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "title": "error",
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "A human readable error"
                    },
                    "details": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": true
                        },
                        {
                          "type": "string",
                          "additionalProperties": true
                        }
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "required": [
                    "error"
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "An example of an error message",
                    "value": {
                      "code": 404,
                      "error": "Ressource not found",
                      "details": "The provided id is wrong"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "partner-api-oauth": [
              "time:write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "partner-api-oauth": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://oauth.payfit.com/authorize",
            "tokenUrl": "https://oauth.payfit.com/token",
            "scopes": {
              "contracts:read": "Allow to read contracts information",
              "collaborators:contracts:write": "Allow to create contracts on a collaborator",
              "contracts:payslips:read": "Allow to read payslips",
              "contracts:time-information:read": "Allow to read time related information of contracts",
              "pension:read": "Allow to read pension documents",
              "collaborators:read": "Read general information of collaborators.",
              "collaborators:write": "Allow to create collaborators.",
              "collaborators:contracts:read": "Read contract information of collaborators.",
              "collaborators:management:read": "Read information about organisation and management.",
              "collaborators:meal-vouchers:read": "Read meal vouchers information of collaborators.",
              "collaborators:personal:read": "Read personal data of collaborators.",
              "collaborators:social-security:read": "Read the social security identifiers of collaborators.",
              "collaborators:legal-identity:read": "Read the legal identity information of collaborators.",
              "collaborators:bank-info:read": "Allow to read the bank info of collaborators.",
              "accounting:read": "Allow to read company accounting information",
              "payment-files:read": "Allow to read company payment file information",
              "time:read": "Allow to read time data",
              "time:write": "Allow to write time data",
              "health-insurance:read": "Allow to read health insurance contracts",
              "health-insurance:write": "Allow to write health insurance contracts"
            }
          }
        }
      }
    }
  }
}
```