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

> Create the intent's mailbox at the email provider now and complete its task. Rarely needed: the mailbox 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 EMAIL_ACCOUNT task: `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 `TICKET_SCHEDULED` before a scheduled task wakes up, `TICKET_CLOSED`, `EXECUTION_IN_PROGRESS`, `EMAIL_ACCOUNT_ALREADY_EXISTS` (the employee already has an account at an address other than their email), `EMAIL_ACCOUNT_NOT_CREATED` (the provider refused), `COMPANY_SAAS_APPLICATION_NOT_CAPABLE`; a refusal leaves the task PENDING with an internal comment on the ticket. 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.

<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/{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:
  /email-account-intents/{intentId}/execute:
    post:
      tags:
        - Onboardings
      summary: Execute an email account intent
      description: >-
        Create the intent's mailbox at the email provider now and complete its
        task. Rarely needed: the mailbox 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 EMAIL_ACCOUNT task: `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 `TICKET_SCHEDULED` before a scheduled task wakes up,
        `TICKET_CLOSED`, `EXECUTION_IN_PROGRESS`, `EMAIL_ACCOUNT_ALREADY_EXISTS`
        (the employee already has an account at an address other than their
        email), `EMAIL_ACCOUNT_NOT_CREATED` (the provider refused),
        `COMPANY_SAAS_APPLICATION_NOT_CAPABLE`; a refusal leaves the task
        PENDING with an internal comment on the ticket. 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.
      operationId: executeEmailAccountIntent
      parameters:
        - name: intentId
          required: true
          in: path
          schema:
            type: string
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecuteEmailAccountIntentResult_Output'
components:
  schemas:
    ExecuteEmailAccountIntentResult_Output:
      type: object
      properties:
        outcome:
          type: string
          description: >-
            ALREADY_EXECUTED: an earlier call or the wake-up created the mailbox
            — nothing was created again
          enum:
            - EXECUTED
            - ALREADY_EXECUTED
        intent:
          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
      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.