> ## 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 a SaaS provisioning intent

> Carry out the account change of a SAAS_PROVISIONING task now, on an application Primo provisions: answers `outcome: STARTED` once the change is queued, and the task completes itself when the application confirms it (read it with `getTicket`). This is the only way to complete such a task: `updateTaskStatus` refuses it with `TaskLockedByTypeError` naming this operation. On an application Primo cannot provision, the task waits for an admin, who makes the change by hand and completes it with `updateTaskStatus`. Safe to retry: a task completed earlier answers `outcome: ALREADY_EXECUTED` and runs nothing again. Refused with `INTENT_NOT_FOUND`, `TICKET_CLOSED` (the task was completed or cancelled), `TICKET_SCHEDULED` (it runs on its date), `EXECUTION_IN_PROGRESS`, `COMPANY_SAAS_APPLICATION_NOT_CAPABLE` (Primo cannot provision this application), `LEAVER_HAS_NO_MANAGER` or `TRANSFER_TARGET_HAS_NO_ACCOUNT` (nobody to transfer the data of a removed account to).

Key: WriteScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /saas-provisioning-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:
  /saas-provisioning-intents/{intentId}/execute:
    post:
      tags:
        - Saas
      summary: Execute a SaaS provisioning intent
      description: >-
        Carry out the account change of a SAAS_PROVISIONING task now, on an
        application Primo provisions: answers `outcome: STARTED` once the change
        is queued, and the task completes itself when the application confirms
        it (read it with `getTicket`). This is the only way to complete such a
        task: `updateTaskStatus` refuses it with `TaskLockedByTypeError` naming
        this operation. On an application Primo cannot provision, the task waits
        for an admin, who makes the change by hand and completes it with
        `updateTaskStatus`. Safe to retry: a task completed earlier answers
        `outcome: ALREADY_EXECUTED` and runs nothing again. Refused with
        `INTENT_NOT_FOUND`, `TICKET_CLOSED` (the task was completed or
        cancelled), `TICKET_SCHEDULED` (it runs on its date),
        `EXECUTION_IN_PROGRESS`, `COMPANY_SAAS_APPLICATION_NOT_CAPABLE` (Primo
        cannot provision this application), `LEAVER_HAS_NO_MANAGER` or
        `TRANSFER_TARGET_HAS_NO_ACCOUNT` (nobody to transfer the data of a
        removed account to).
      operationId: executeSaasProvisioningIntent
      parameters:
        - name: intentId
          required: true
          in: path
          schema:
            type: string
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ExecuteSaasProvisioningIntentResult_Output
components:
  schemas:
    ExecuteSaasProvisioningIntentResult_Output:
      type: object
      properties:
        outcome:
          type: string
          description: >-
            STARTED: Primo is carrying the account change out, and completes the
            task once the application confirms it. EXECUTED: the change was
            already made, the task is now completed. ALREADY_EXECUTED: the task
            was completed earlier, nothing ran again.
          enum:
            - STARTED
            - EXECUTED
            - ALREADY_EXECUTED
        intent:
          type: object
          properties:
            id:
              type: string
              description: Intent id
            taskId:
              description: The SAAS_PROVISIONING task that tracks the account
              anyOf:
                - type: string
                - type: 'null'
            ticketId:
              description: >-
                The ticket holding that task: the parentTicketId sent, or the
                one Primo opened; null when the intent has no task
              anyOf:
                - type: string
                - type: 'null'
            employeeId:
              description: >-
                The employee the account is for; null on an account opened for
                the hire of an onboarding before its employee exists
              anyOf:
                - type: string
                - type: 'null'
            onboardingId:
              description: >-
                The onboarding whose hire the account is for, when it was opened
                for one
              default: null
              anyOf:
                - type: string
                - type: 'null'
            saasId:
              type: string
            direction:
              type: string
              enum:
                - PROVISION
                - DEPROVISION
                - UPDATE
            identityId:
              anyOf:
                - type: string
                - type: 'null'
            email:
              description: The address a PROVISION intent creates the account with
              anyOf:
                - type: string
                - type: 'null'
            groups:
              type: array
              items:
                type: object
                properties:
                  id:
                    description: >-
                      The entitlement id from `getSaasById`, or null for one
                      only an admin knows by name
                    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`, or null for one
                      only an admin knows by name
                    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`, or null for one
                      only an admin knows by name
                    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`, or null for one
                      only an admin knows by name
                    anyOf:
                      - type: string
                      - type: 'null'
                  name:
                    type: string
                    minLength: 1
                required:
                  - id
                  - name
                additionalProperties: false
            executedAt:
              description: >-
                When Primo carried the account out; null while it waits on its
                date or on the admin
              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))$
          required:
            - id
            - taskId
            - ticketId
            - employeeId
            - onboardingId
            - saasId
            - direction
            - identityId
            - email
            - groups
            - roles
            - licenses
            - organizationUnits
            - executedAt
            - createdAt
          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.