> ## 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.

# Execute an employee creation intent

> Carry out an employee creation intent: creates the employee (or updates the one the onboarding already holds) from the intent, links them to the onboarding, cancels a leftover offboarding, adds them to the company in Clerk — a real user account — links the employee to its task and completes the task. Rarely needed: the employee is created on its own when the task is created without a date or wakes up on its date. Use it to retry after a refusal left the task PENDING with a comment. This is the only way to complete an EMPLOYEE_CREATION task by hand: `updateTaskStatus` refuses it with `TaskLockedByTypeError` naming this operation. Safe to retry: an intent executed earlier answers `outcome: ALREADY_EXECUTED` and creates nothing again. Refused with `EMPLOYEE_INFORMATION_INCOMPLETE` (first name, last name, work email and start date are all required: fix them with `updateEmployeeCreationIntent`), `TICKET_SCHEDULED` before a scheduled task wakes up, `TICKET_CLOSED`, `EXECUTION_IN_PROGRESS`, `INVALID_EMAIL`, `FAIL_TO_CREATE_OR_UPDATE_EMPLOYEE`; a refusal leaves the task PENDING with an internal comment on the ticket. `completeOnboarding` closes a whole onboarding without this task; use this operation for an EMPLOYEE_CREATION task.



## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /employee-creation-intents/{intentId}/execute
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-creation-intents/{intentId}/execute:
    post:
      tags:
        - Onboardings
      summary: Execute an employee creation intent
      description: >-
        Carry out an employee creation intent: creates the employee (or updates
        the one the onboarding already holds) from the intent, links them to the
        onboarding, cancels a leftover offboarding, adds them to the company in
        Clerk — a real user account — links the employee to its task and
        completes the task. Rarely needed: the employee is created on its own
        when the task is created without a date or wakes up on its date. Use it
        to retry after a refusal left the task PENDING with a comment. This is
        the only way to complete an EMPLOYEE_CREATION task by hand:
        `updateTaskStatus` refuses it with `TaskLockedByTypeError` naming this
        operation. Safe to retry: an intent executed earlier answers `outcome:
        ALREADY_EXECUTED` and creates nothing again. Refused with
        `EMPLOYEE_INFORMATION_INCOMPLETE` (first name, last name, work email and
        start date are all required: fix them with
        `updateEmployeeCreationIntent`), `TICKET_SCHEDULED` before a scheduled
        task wakes up, `TICKET_CLOSED`, `EXECUTION_IN_PROGRESS`,
        `INVALID_EMAIL`, `FAIL_TO_CREATE_OR_UPDATE_EMPLOYEE`; a refusal leaves
        the task PENDING with an internal comment on the ticket.
        `completeOnboarding` closes a whole onboarding without this task; use
        this operation for an EMPLOYEE_CREATION task.
      operationId: executeEmployeeCreationIntent
      parameters:
        - name: intentId
          required: true
          in: path
          schema:
            type: string
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ExecuteEmployeeCreationIntentResult_Output
components:
  schemas:
    ExecuteEmployeeCreationIntentResult_Output:
      type: object
      properties:
        outcome:
          type: string
          description: >-
            ALREADY_EXECUTED: an earlier call did the work — nothing was created
            again
          enum:
            - EXECUTED
            - ALREADY_EXECUTED
        intent:
          type: object
          properties:
            id:
              type: string
              description: >-
                Intent id — pass it to `updateEmployeeCreationIntent` and
                `executeEmployeeCreationIntent`
            taskId:
              description: The EMPLOYEE_CREATION task that tracks this employee creation
              anyOf:
                - type: string
                - type: 'null'
            ticketId:
              description: >-
                The ticket holding that task: the parentTicketId sent, or the
                one Primo opened. Null if it could not be read back.
              anyOf:
                - type: string
                - type: 'null'
            onboardingId:
              type: string
            firstName:
              anyOf:
                - type: string
                - type: 'null'
            lastName:
              anyOf:
                - type: string
                - type: 'null'
            email:
              anyOf:
                - type: string
                - type: 'null'
            personalEmail:
              anyOf:
                - type: string
                - type: 'null'
            phone:
              anyOf:
                - type: string
                - type: 'null'
            startDate:
              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'
            employmentType:
              anyOf:
                - type: string
                  enum:
                    - INTERNAL
                    - CONTRACTOR
                - type: 'null'
            job:
              anyOf:
                - type: object
                  properties:
                    id:
                      anyOf:
                        - type: string
                        - type: 'null'
                    name:
                      type: string
                  required:
                    - id
                    - name
                  additionalProperties: false
                - type: 'null'
            legalEntity:
              anyOf:
                - type: object
                  properties:
                    id:
                      anyOf:
                        - type: string
                        - type: 'null'
                    name:
                      type: string
                  required:
                    - id
                    - name
                  additionalProperties: false
                - type: 'null'
            workLocation:
              anyOf:
                - type: object
                  properties:
                    id:
                      anyOf:
                        - type: string
                        - type: 'null'
                    name:
                      type: string
                  required:
                    - id
                    - name
                  additionalProperties: false
                - type: 'null'
            teams:
              type: array
              items:
                type: object
                properties:
                  id:
                    anyOf:
                      - type: string
                      - type: 'null'
                  name:
                    type: string
                required:
                  - id
                  - name
                additionalProperties: false
            managerId:
              anyOf:
                - type: string
                - type: 'null'
            address:
              anyOf:
                - type: object
                  properties:
                    name:
                      anyOf:
                        - type: string
                        - type: 'null'
                    contactName:
                      anyOf:
                        - type: string
                        - type: 'null'
                    phone:
                      anyOf:
                        - type: string
                        - type: 'null'
                    street:
                      type: string
                      minLength: 1
                    complement:
                      anyOf:
                        - type: string
                        - type: 'null'
                    postalCode:
                      type: string
                      minLength: 1
                    city:
                      type: string
                      minLength: 1
                    country:
                      anyOf:
                        - type: string
                        - type: 'null'
                    countryCode:
                      anyOf:
                        - type: string
                        - type: 'null'
                  required:
                    - name
                    - contactName
                    - phone
                    - street
                    - complement
                    - postalCode
                    - city
                    - country
                    - countryCode
                  additionalProperties: false
                - type: 'null'
            employeeId:
              description: The employee created on execute, null until then
              anyOf:
                - type: string
                - type: 'null'
            executedAt:
              description: When the intent was executed; null while it can still change
              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'
            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))$
            updatedAt:
              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))$
          required:
            - id
            - taskId
            - ticketId
            - onboardingId
            - firstName
            - lastName
            - email
            - personalEmail
            - phone
            - startDate
            - employmentType
            - job
            - legalEntity
            - workLocation
            - teams
            - managerId
            - address
            - employeeId
            - executedAt
            - createdAt
            - updatedAt
          additionalProperties: false
      required:
        - outcome
        - intent
      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.