> ## 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 an email account intent

> Ask for an employee's professional mailbox at the company's email provider as a task a ticket tracks. Creates the intent and its EMAIL_ACCOUNT task. Without `scheduleDate` the mailbox is created right away; with one, the task sleeps until that date and the mailbox is created when it wakes up — nobody has to execute it. Pass the onboarding ticket as `parentTicketId`; without one Primo opens a ticket for the employee to hold the task. `createTicket` and `createTask` cannot make a typed task. The mailbox is created at the employee's email as it stands when the task runs: set or fix that address on the employee (`updateEmployee`), not here. Returns the intent `id`, its `taskId` and the `ticketId` holding it. The task cannot be marked done by hand; it completes when the mailbox exists. Take the groups, roles, licenses and organization units from `getSaasById` of the email provider (the SaaS with `isEmailProvider` in `getSaas`). For an onboarding still on the classic email step, the step is handled by the onboarding itself; this intent is the email work tracked as a task on a ticket (an EMAIL_ACCOUNT task), and never closes an onboarding email step. Refused with `EMAIL_PROVIDER_NOT_FOUND` (no connected email provider), `COMPANY_SAAS_APPLICATION_NOT_CAPABLE` (the provider does not create users automatically), `EMPLOYEE_NOT_FOUND`, `PARENT_TICKET_IS_TYPED` or `PARENT_TICKET_IS_A_TASK` (pass the untyped ticket instead), `PARENT_TICKET_NOT_FOUND`.

<span className="badge-write">Key: Write</span><span className="badge-company">Scope: Company</span>


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /email-account-intents
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:
  /email-account-intents:
    post:
      tags:
        - Onboardings
      summary: Create an email account intent
      description: >-
        Ask for an employee's professional mailbox at the company's email
        provider as a task a ticket tracks. Creates the intent and its
        EMAIL_ACCOUNT task. Without `scheduleDate` the mailbox is created right
        away; with one, the task sleeps until that date and the mailbox is
        created when it wakes up — nobody has to execute it. Pass the onboarding
        ticket as `parentTicketId`; without one Primo opens a ticket for the
        employee to hold the task. `createTicket` and `createTask` cannot make a
        typed task. The mailbox is created at the employee's email as it stands
        when the task runs: set or fix that address on the employee
        (`updateEmployee`), not here. Returns the intent `id`, its `taskId` and
        the `ticketId` holding it. The task cannot be marked done by hand; it
        completes when the mailbox exists. Take the groups, roles, licenses and
        organization units from `getSaasById` of the email provider (the SaaS
        with `isEmailProvider` in `getSaas`). For an onboarding still on the
        classic email step, the step is handled by the onboarding itself; this
        intent is the email work tracked as a task on a ticket (an EMAIL_ACCOUNT
        task), and never closes an onboarding email step. Refused with
        `EMAIL_PROVIDER_NOT_FOUND` (no connected email provider),
        `COMPANY_SAAS_APPLICATION_NOT_CAPABLE` (the provider does not create
        users automatically), `EMPLOYEE_NOT_FOUND`, `PARENT_TICKET_IS_TYPED` or
        `PARENT_TICKET_IS_A_TASK` (pass the untyped ticket instead),
        `PARENT_TICKET_NOT_FOUND`.
      operationId: createEmailAccountIntent
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEmailAccountIntentBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailAccountIntent_Output'
components:
  schemas:
    CreateEmailAccountIntentBody:
      type: object
      properties:
        groups:
          type: array
          items:
            type: object
            properties:
              id:
                description: The entitlement id from `getSaasById` of the email provider
                anyOf:
                  - type: string
                  - type: 'null'
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
        roles:
          type: array
          items:
            type: object
            properties:
              id:
                description: The entitlement id from `getSaasById` of the email provider
                anyOf:
                  - type: string
                  - type: 'null'
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
        licenses:
          type: array
          items:
            type: object
            properties:
              id:
                description: The entitlement id from `getSaasById` of the email provider
                anyOf:
                  - type: string
                  - type: 'null'
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
        organizationUnits:
          type: array
          items:
            type: object
            properties:
              id:
                description: The entitlement id from `getSaasById` of the email provider
                anyOf:
                  - type: string
                  - type: 'null'
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
        personalEmail:
          description: The employee's personal address, saved on the employee on execute.
          anyOf:
            - 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,}$
            - type: 'null'
        employeeId:
          description: >-
            The employee the mailbox is for (from `getEmployees`). Fixed once
            created.
          type: string
          pattern: ^[a-f\d]{24}$
        credentialsRecipient:
          type: object
          properties:
            type:
              description: >-
                Who receives the temporary password. EMPLOYEE sends it to
                `personalEmail`.
              type: string
              enum:
                - ADMIN
                - EMPLOYEE
                - MANAGER
                - TASK_OWNER
            email:
              description: The address the password is sent to
              anyOf:
                - 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,}$
                - type: string
                  const: ''
          required:
            - type
            - email
        parentTicketId:
          description: >-
            The untyped ticket the work belongs to (an onboarding ticket). Omit
            it and Primo opens one.
          anyOf:
            - type: string
              pattern: ^[a-f\d]{24}$
            - type: 'null'
        scheduleDate:
          description: >-
            Creates the task SCHEDULED until this date; the mailbox is created
            when it wakes up. Without it, the mailbox is created right away.
          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'
      required:
        - employeeId
        - credentialsRecipient
    EmailAccountIntent_Output:
      type: object
      properties:
        id:
          type: string
          description: >-
            Intent id — pass it to `updateEmailAccountIntent` and
            `executeEmailAccountIntent`
        taskId:
          description: The EMAIL_ACCOUNT task that tracks the mailbox
          anyOf:
            - type: string
            - type: 'null'
        ticketId:
          description: >-
            The ticket holding that task: the parentTicketId sent, or the one
            Primo opened. Null if unreadable.
          anyOf:
            - type: string
            - type: 'null'
        employeeId:
          type: string
        companySaasApplicationId:
          type: string
          description: The company's email provider
        credentialsRecipient:
          type: object
          properties:
            type:
              description: >-
                Who receives the temporary password. EMPLOYEE sends it to
                `personalEmail`.
              type: string
              enum:
                - ADMIN
                - EMPLOYEE
                - MANAGER
                - TASK_OWNER
            email:
              description: The address the password is sent to
              anyOf:
                - 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,}$
                - type: string
                  const: ''
          required:
            - type
            - email
          additionalProperties: false
        personalEmail:
          anyOf:
            - type: string
            - type: 'null'
        groups:
          type: array
          items:
            type: object
            properties:
              id:
                description: The entitlement id from `getSaasById` of the email provider
                anyOf:
                  - type: string
                  - type: 'null'
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
            additionalProperties: false
        roles:
          type: array
          items:
            type: object
            properties:
              id:
                description: The entitlement id from `getSaasById` of the email provider
                anyOf:
                  - type: string
                  - type: 'null'
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
            additionalProperties: false
        licenses:
          type: array
          items:
            type: object
            properties:
              id:
                description: The entitlement id from `getSaasById` of the email provider
                anyOf:
                  - type: string
                  - type: 'null'
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
            additionalProperties: false
        organizationUnits:
          type: array
          items:
            type: object
            properties:
              id:
                description: The entitlement id from `getSaasById` of the email provider
                anyOf:
                  - type: string
                  - type: 'null'
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
            additionalProperties: false
        createdEmail:
          description: The address the provider created, null until executed
          anyOf:
            - type: string
            - type: 'null'
        executedAt:
          description: When the mailbox was created; null while the intent can 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
        - employeeId
        - companySaasApplicationId
        - credentialsRecipient
        - personalEmail
        - groups
        - roles
        - licenses
        - organizationUnits
        - createdEmail
        - executedAt
        - createdAt
        - updatedAt
      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.