> ## 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 the purchasing settings

> Change the company's order notification email and default device lifetime, as an admin does on the cockpit's Procurement settings page, and return the settings as `getPurchasingSettings` does. Only the fields given change: `orderEmail` (null removes it) and `defaultDeviceDecommissioningYears` (2, 3, 4 or 5), at least one of them. A new lifetime applies to the devices purchased from then on; `updateDecommissioningDateOfAllDevices: true` also rewrites the refresh date of every existing device that has a purchase date, which replaces dates set by hand. AppleCare Enterprise is changed with `updateAppleCareEnterprise` instead, a country is opened to orders with `requestShippingCountry`, and the policies are changed with `updateEquipmentPolicy` and `updatePurchasingPolicy`.

Key: WriteScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json patch /purchasing-settings
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:
  /purchasing-settings:
    patch:
      tags:
        - PurchasingSettings
      summary: Update the purchasing settings
      description: >-
        Change the company's order notification email and default device
        lifetime, as an admin does on the cockpit's Procurement settings page,
        and return the settings as `getPurchasingSettings` does. Only the fields
        given change: `orderEmail` (null removes it) and
        `defaultDeviceDecommissioningYears` (2, 3, 4 or 5), at least one of
        them. A new lifetime applies to the devices purchased from then on;
        `updateDecommissioningDateOfAllDevices: true` also rewrites the refresh
        date of every existing device that has a purchase date, which replaces
        dates set by hand. AppleCare Enterprise is changed with
        `updateAppleCareEnterprise` instead, a country is opened to orders with
        `requestShippingCountry`, and the policies are changed with
        `updateEquipmentPolicy` and `updatePurchasingPolicy`.
      operationId: updatePurchasingSettings
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePurchasingSettingsBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurchasingSettings_Output'
components:
  schemas:
    UpdatePurchasingSettingsBody:
      type: object
      properties:
        orderEmail:
          description: >-
            Email that receives the order notifications. null removes it; left
            out, the stored one stays.
          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'
        defaultDeviceDecommissioningYears:
          description: >-
            Default lifetime of a device, in years: 2, 3, 4 or 5. Left out, the
            stored one stays.
          type: number
          enum:
            - 2
            - 3
            - 4
            - 5
        updateDecommissioningDateOfAllDevices:
          description: >-
            true also rewrites the refresh date of every existing device that
            has a purchase date, to that date plus
            `defaultDeviceDecommissioningYears`, which must then be given. Left
            out or false, only the devices purchased from now on get the new
            lifetime.
          type: boolean
    PurchasingSettings_Output:
      type: object
      properties:
        orderEmail:
          description: Email that receives the order notifications, null when none is set.
          anyOf:
            - type: string
            - type: 'null'
        defaultDeviceDecommissioningYears:
          type: number
          description: >-
            Default lifetime of a device, in years: the refresh date
            (`decommissioningDate`) Primo gives a device is its purchase date
            plus this.
        appleCareEnterpriseEnrollmentId:
          description: >-
            AppleCare Enterprise enrollment ID of the company, null when it is
            not enrolled.
          anyOf:
            - type: string
            - type: 'null'
        appleCareEnterpriseDurationYears:
          type: number
          description: >-
            AppleCare Enterprise coverage duration, in years. It only applies
            once an enrollment ID is set.
          enum:
            - 3
            - 4
      required:
        - orderEmail
        - defaultDeviceDecommissioningYears
        - appleCareEnterpriseEnrollmentId
        - appleCareEnterpriseDurationYears
      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.