> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getprimo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create the offboarding of a leaver from an HR system event

> Start the offboarding of a leaver from what an HR system or an automation knows: an email address of the employee, the last day, and a free `data` object with everything else. Primo finds the employee holding that address and starts the offboarding as `createOffboarding` does: the ticket and its first steps, or the Offboarding Agent when it runs the offboardings of the company. `data` is written on the offboarding as its notes for the agent. Refused with 404 `EMPLOYEE_NOT_FOUND` when no employee holds the address (a hidden employee is not matched), 409 `SEVERAL_EMPLOYEES_WITH_EMAIL` when more than one does, and the refusals of `createOffboarding` (`OFFBOARDING_ALREADY_EXISTS`, `TERMINATION_DATE_REQUIRED`, …). With the employee id in hand, use `createOffboarding` instead.

Key: WriteScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /employee-offboardings
openapi: 3.1.1
info:
  title: Public API - BETA
  description: Read docs on https://docs.getprimo.com/
  version: '1.0'
  contact: {}
servers:
  - url: https://api.getprimo.com
security:
  - apikey: []
tags: []
paths:
  /employee-offboardings:
    post:
      tags:
        - Offboardings
      summary: Create the offboarding of a leaver from an HR system event
      description: >-
        Start the offboarding of a leaver from what an HR system or an
        automation knows: an email address of the employee, the last day, and a
        free `data` object with everything else. Primo finds the employee
        holding that address and starts the offboarding as `createOffboarding`
        does: the ticket and its first steps, or the Offboarding Agent when it
        runs the offboardings of the company. `data` is written on the
        offboarding as its notes for the agent. Refused with 404
        `EMPLOYEE_NOT_FOUND` when no employee holds the address (a hidden
        employee is not matched), 409 `SEVERAL_EMPLOYEES_WITH_EMAIL` when more
        than one does, and the refusals of `createOffboarding`
        (`OFFBOARDING_ALREADY_EXISTS`, `TERMINATION_DATE_REQUIRED`, …). With the
        employee id in hand, use `createOffboarding` instead.
      operationId: createEmployeeOffboarding
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEmployeeOffboardingBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOffboarding_Output'
components:
  schemas:
    CreateEmployeeOffboardingBody:
      type: object
      properties:
        email:
          description: An email address of the leaver, as Primo knows it
          type: string
          format: email
          pattern: >-
            ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
        terminationDate:
          description: >-
            The leaver's last day (YYYY-MM-DD or ISO 8601). Defaults to the
            termination date already on the employee.
          anyOf:
            - anyOf:
                - type: string
                  format: date
                  pattern: >-
                    ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
                - type: string
                  format: date-time
                  pattern: >-
                    ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
            - type: 'null'
        data:
          description: >-
            Everything else the caller knows about the departure, as a free JSON
            object (reason, manager, equipment, who takes over…), at most 5000
            characters once serialized. Written on the offboarding as its notes
            for the Offboarding Agent. May hold personal data.
          anyOf:
            - type: object
              propertyNames:
                type: string
              additionalProperties: {}
            - type: 'null'
      required:
        - email
    GetOffboarding_Output:
      type: object
      properties:
        id:
          type: string
        employeeId:
          type: string
        ticketId:
          description: The offboarding ticket, whose tasks are its steps (`getTicket`)
          anyOf:
            - type: string
            - type: 'null'
        ticketReference:
          description: The reference the cockpit shows for that ticket
          anyOf:
            - type: string
            - type: 'null'
        isLegacy:
          description: >-
            Whether the offboarding runs on the steppers from before offboarding
            tickets
          type: boolean
        stepModel:
          description: >-
            How the offboarding holds its steps: ACTIONS (the steppers from
            before offboarding tickets) or INTENTS (typed tasks under its
            ticket, run through the intent tools such as
            `executeOffboardingConfirmationIntent`). Null while it has neither a
            ticket nor a step.
          anyOf:
            - type: string
              enum:
                - ACTIONS
                - INTENTS
            - type: 'null'
        status:
          type: string
          enum:
            - PENDING
            - SCHEDULED
            - IN_PROGRESS
            - CLOSED
            - CANCELED
        source:
          type: string
          enum:
            - COCKPIT
            - MERGE
            - KOMBO
            - API
        runBy:
          description: >-
            Who runs the offboarding, decided once at its creation: AGENT (the
            Offboarding Agent, on its own ticket) or CLASSIC (the ticket and
            steps of the offboarding settings). Null on one created before.
          anyOf:
            - type: string
              enum:
                - AGENT
                - CLASSIC
            - type: 'null'
        ticketWakeDate:
          description: >-
            When the Offboarding Agent asked its ticket to wake it next; null
            while it sleeps on nothing.
          anyOf:
            - type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
            - type: 'null'
        terminationDate:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        createdAt:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        notes:
          description: >-
            Free text the admin or the caller wrote for the Offboarding Agent at
            its creation. May hold personal data: returned on a single
            offboarding only, never on getOffboardings.
          anyOf:
            - type: string
            - type: 'null'
      required:
        - id
        - employeeId
        - isLegacy
        - status
        - source
        - terminationDate
        - createdAt
      additionalProperties: false
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.