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

# Update a device handling intent

> Change what happens to the leaver devices and accessories, or the return shipment request, before the intent executes; read the current proposal with `getDeviceHandlingIntent`. `devices` and `accessories` are each replaced whole; null leaves a field as it is. Each device and accessory of the leaver goes back in stock (PUT_BACK_IN_STOCK), to a new `owner` (REASSIGN) or out of the fleet (DECOMISSION), with an optional MDM action on its data (`data`: WIPE, LOCK…). Item ids come from `getEmployee` of the leaver (`deviceIds`, `accessoryIds`). Only the fields you send change. Refused with `INTENT_NOT_FOUND`, `INTENT_ALREADY_EXECUTED` once executed, `TICKET_CLOSED` when its task is completed or cancelled, `EXECUTION_IN_PROGRESS`, `DEVICE_NOT_OWNED_BY_EMPLOYEE`, `ACCESSORY_NOT_OWNED_BY_EMPLOYEE`, `REASSIGN_OWNER_REQUIRED`, `REASSIGN_OWNER_IS_LEAVER`, `REASSIGN_OWNER_NOT_FOUND`.

Key: WriteScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json patch /device-handling-intents/{intentId}
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:
  /device-handling-intents/{intentId}:
    patch:
      tags:
        - Offboardings
      summary: Update a device handling intent
      description: >-
        Change what happens to the leaver devices and accessories, or the return
        shipment request, before the intent executes; read the current proposal
        with `getDeviceHandlingIntent`. `devices` and `accessories` are each
        replaced whole; null leaves a field as it is. Each device and accessory
        of the leaver goes back in stock (PUT_BACK_IN_STOCK), to a new `owner`
        (REASSIGN) or out of the fleet (DECOMISSION), with an optional MDM
        action on its data (`data`: WIPE, LOCK…). Item ids come from
        `getEmployee` of the leaver (`deviceIds`, `accessoryIds`). Only the
        fields you send change. Refused with `INTENT_NOT_FOUND`,
        `INTENT_ALREADY_EXECUTED` once executed, `TICKET_CLOSED` when its task
        is completed or cancelled, `EXECUTION_IN_PROGRESS`,
        `DEVICE_NOT_OWNED_BY_EMPLOYEE`, `ACCESSORY_NOT_OWNED_BY_EMPLOYEE`,
        `REASSIGN_OWNER_REQUIRED`, `REASSIGN_OWNER_IS_LEAVER`,
        `REASSIGN_OWNER_NOT_FOUND`.
      operationId: updateDeviceHandlingIntent
      parameters:
        - name: intentId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDeviceHandlingIntentBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceHandlingIntent_Output'
components:
  schemas:
    UpdateDeviceHandlingIntentBody:
      type: object
      properties:
        devices:
          description: What happens to each device; replaced whole
          anyOf:
            - type: array
              items:
                type: object
                properties:
                  deviceId:
                    description: A device the leaver holds
                    type: string
                    pattern: ^[a-f\d]{24}$
                  deviceName:
                    anyOf:
                      - type: string
                      - type: 'null'
                  recycle:
                    description: >-
                      PUT_BACK_IN_STOCK, REASSIGN to `owner`, or DECOMISSION
                      (retired from the fleet)
                    type: string
                    enum:
                      - PUT_BACK_IN_STOCK
                      - REASSIGN
                      - DECOMISSION
                  data:
                    description: >-
                      The MDM action on the device data; null or NOTHING for
                      none
                    anyOf:
                      - type: string
                        enum:
                          - SOFT_WIPE
                          - HARD_WIPE
                          - WIPE
                          - LOCK
                          - NOTHING
                      - type: 'null'
                  condition:
                    anyOf:
                      - type: string
                        enum:
                          - BROKEN
                          - FAIR
                          - GOOD
                          - EXCELLENT
                      - type: 'null'
                  notes:
                    anyOf:
                      - type: string
                      - type: 'null'
                  owner:
                    description: The new owner, required with REASSIGN; never the leaver
                    anyOf:
                      - type: string
                        pattern: ^[a-f\d]{24}$
                      - type: 'null'
                required:
                  - deviceId
                  - recycle
            - type: 'null'
        accessories:
          description: What happens to each accessory; replaced whole
          anyOf:
            - type: array
              items:
                type: object
                properties:
                  accessoryId:
                    description: An accessory the leaver holds
                    type: string
                    pattern: ^[a-f\d]{24}$
                  accessoryName:
                    anyOf:
                      - type: string
                      - type: 'null'
                  recycle:
                    type: string
                    enum:
                      - PUT_BACK_IN_STOCK
                      - REASSIGN
                      - DECOMISSION
                  owner:
                    description: The new owner, required with REASSIGN; never the leaver
                    anyOf:
                      - type: string
                        pattern: ^[a-f\d]{24}$
                      - type: 'null'
                required:
                  - accessoryId
                  - recycle
            - type: 'null'
        returnShipmentRequested:
          description: >-
            Ask for a return shipment once the devices are handled, when the
            settings leave it to each offboarding
          anyOf:
            - type: boolean
            - type: 'null'
    DeviceHandlingIntent_Output:
      type: object
      properties:
        id:
          type: string
          description: Intent id, to pass to its update and execute tools
        taskId:
          description: The typed task that tracks this step
          anyOf:
            - type: string
            - type: 'null'
        ticketId:
          description: >-
            The ticket holding that task, usually the offboarding ticket. Null
            if it could not be read back.
          anyOf:
            - type: string
            - type: 'null'
        offboardingId:
          type: string
        executedAt:
          description: When the intent executed; null until then
          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'
        devices:
          type: array
          items:
            type: object
            properties:
              deviceId:
                type: string
              deviceName:
                anyOf:
                  - type: string
                  - type: 'null'
              recycle:
                type: string
                enum:
                  - PUT_BACK_IN_STOCK
                  - REASSIGN
                  - DECOMISSION
              data:
                anyOf:
                  - type: string
                    enum:
                      - SOFT_WIPE
                      - HARD_WIPE
                      - WIPE
                      - LOCK
                      - NOTHING
                  - type: 'null'
              condition:
                anyOf:
                  - type: string
                    enum:
                      - BROKEN
                      - FAIR
                      - GOOD
                      - EXCELLENT
                  - type: 'null'
              notes:
                anyOf:
                  - type: string
                  - type: 'null'
              owner:
                anyOf:
                  - type: string
                  - type: 'null'
            required:
              - deviceId
              - deviceName
              - recycle
              - data
              - condition
              - notes
              - owner
            additionalProperties: false
        accessories:
          type: array
          items:
            type: object
            properties:
              accessoryId:
                type: string
              accessoryName:
                anyOf:
                  - type: string
                  - type: 'null'
              recycle:
                type: string
                enum:
                  - PUT_BACK_IN_STOCK
                  - REASSIGN
                  - DECOMISSION
              owner:
                anyOf:
                  - type: string
                  - type: 'null'
            required:
              - accessoryId
              - accessoryName
              - recycle
              - owner
            additionalProperties: false
        returnShipmentRequested:
          type: boolean
      required:
        - id
        - taskId
        - ticketId
        - offboardingId
        - executedAt
        - devices
        - accessories
        - returnShipmentRequested
      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.