> ## 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 SaaS contract

> Replace the contract configuration for the given SaaS. All prices must be expressed for one billing period defined by `billingFrequency` (not annualized).

**`flat_rate` mode** — a single recurring amount covers the whole subscription:
- `flatRatePrice` must be set.
- `unlicensedPricePerSeat`, `unlicensedMinimumSeatsBilled`, `licenses[].pricePerSeat` and `licenses[].minimumSeatsBilled` must all be `null`.

**`per_licence` mode** — pricing is broken down per license type:
- `flatRatePrice` must be `null`.
- `unlicensedPricePerSeat`, `unlicensedMinimumSeatsBilled`, `licenses[].pricePerSeat` and `licenses[].minimumSeatsBilled` must all be set.

The `licenses` array must exactly match the licenses defined in the SaaS: every entry must have the same `id` as the corresponding SaaS license (retrieve them via `getSaasById`).

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


## OpenAPI

````yaml https://api.getprimo.com/openapi.json put /saas/{saasId}/contract
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/{saasId}/contract:
    put:
      tags:
        - Saas
      summary: Update a SaaS contract
      description: >-
        Replace the contract configuration for the given SaaS. All prices must
        be expressed for one billing period defined by `billingFrequency` (not
        annualized).


        **`flat_rate` mode** — a single recurring amount covers the whole
        subscription:

        - `flatRatePrice` must be set.

        - `unlicensedPricePerSeat`, `unlicensedMinimumSeatsBilled`,
        `licenses[].pricePerSeat` and `licenses[].minimumSeatsBilled` must all
        be `null`.


        **`per_licence` mode** — pricing is broken down per license type:

        - `flatRatePrice` must be `null`.

        - `unlicensedPricePerSeat`, `unlicensedMinimumSeatsBilled`,
        `licenses[].pricePerSeat` and `licenses[].minimumSeatsBilled` must all
        be set.


        The `licenses` array must exactly match the licenses defined in the
        SaaS: every entry must have the same `id` as the corresponding SaaS
        license (retrieve them via `getSaasById`).
      operationId: updateSaasContract
      parameters:
        - name: saasId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSaasContractBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SaasContractResource_Output'
components:
  schemas:
    UpdateSaasContractBody:
      type: object
      properties:
        pricingMode:
          description: >-
            Contract pricing mode. Use `flat_rate` for one recurring amount or
            `per_licence` for license-based pricing.
          anyOf:
            - type: string
              enum:
                - per_licence
                - flat_rate
            - type: 'null'
        currency:
          description: ISO currency code used for all contract prices.
          anyOf:
            - type: string
              enum:
                - EUR
                - GBP
                - USD
                - CHF
                - CAD
            - type: 'null'
        billingFrequency:
          description: >-
            Billing period used by every price in this contract: monthly,
            quarterly, or annual.
          anyOf:
            - type: string
              enum:
                - monthly
                - quarterly
                - annual
            - type: 'null'
        flatRatePrice:
          description: >-
            Recurring flat-rate amount billed for one billing period defined by
            `billingFrequency`. Not annualized. Required when `pricingMode` is
            `flat_rate`; must be `null` when `pricingMode` is `per_licence`.
          anyOf:
            - type: number
            - type: 'null'
        unlicensedPricePerSeat:
          description: >-
            Price billed per unlicensed seat for one billing period defined by
            `billingFrequency`. Not annualized. Required when `pricingMode` is
            `per_licence`; must be `null` when `pricingMode` is `flat_rate`.
          anyOf:
            - type: number
            - type: 'null'
        unlicensedMinimumSeatsBilled:
          description: >-
            Minimum number of unlicensed seats billed during one billing period.
            Required when `pricingMode` is `per_licence`; must be `null` when
            `pricingMode` is `flat_rate`.
          anyOf:
            - type: integer
              minimum: 0
              maximum: 9007199254740991
            - type: 'null'
        licenses:
          description: >-
            Priced contract lines, one entry per SaaS license. Required when
            `pricingMode` is `per_licence`; all `pricePerSeat` and
            `minimumSeatsBilled` values must be `null` when `pricingMode` is
            `flat_rate`. The list must exactly match the licenses defined in the
            SaaS (same `id` for every entry).
          type: array
          items:
            type: object
            properties:
              id:
                description: >-
                  License identifier used to map this priced contract line to a
                  SaaS license.
                type: string
              pricePerSeat:
                description: >-
                  Price billed per seat for one billing period defined by
                  `billingFrequency`. Not annualized. Required when
                  `pricingMode` is `per_licence`; must be `null` when
                  `pricingMode` is `flat_rate`.
                anyOf:
                  - type: number
                  - type: 'null'
              minimumSeatsBilled:
                description: >-
                  Minimum number of seats billed for this license during one
                  billing period. Required when `pricingMode` is `per_licence`;
                  must be `null` when `pricingMode` is `flat_rate`.
                anyOf:
                  - type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  - type: 'null'
            required:
              - id
              - pricePerSeat
              - minimumSeatsBilled
      required:
        - pricingMode
        - currency
        - billingFrequency
        - flatRatePrice
        - unlicensedPricePerSeat
        - unlicensedMinimumSeatsBilled
        - licenses
    SaasContractResource_Output:
      type: object
      properties:
        contract:
          description: Billing contract currently configured for this SaaS.
          anyOf:
            - type: object
              properties:
                pricingMode:
                  description: >-
                    Contract pricing mode. Use `flat_rate` for one recurring
                    amount or `per_licence` for license-based pricing.
                  anyOf:
                    - type: string
                      enum:
                        - per_licence
                        - flat_rate
                    - type: 'null'
                currency:
                  description: ISO currency code used for all contract prices.
                  anyOf:
                    - type: string
                      enum:
                        - EUR
                        - GBP
                        - USD
                        - CHF
                        - CAD
                    - type: 'null'
                billingFrequency:
                  description: >-
                    Billing period used by every price in this contract:
                    monthly, quarterly, or annual.
                  anyOf:
                    - type: string
                      enum:
                        - monthly
                        - quarterly
                        - annual
                    - type: 'null'
                flatRatePrice:
                  description: >-
                    Recurring flat-rate amount billed for one billing period
                    defined by `billingFrequency`. Not annualized. Required when
                    `pricingMode` is `flat_rate`; must be `null` when
                    `pricingMode` is `per_licence`.
                  anyOf:
                    - type: number
                    - type: 'null'
                unlicensedPricePerSeat:
                  description: >-
                    Price billed per unlicensed seat for one billing period
                    defined by `billingFrequency`. Not annualized. Required when
                    `pricingMode` is `per_licence`; must be `null` when
                    `pricingMode` is `flat_rate`.
                  anyOf:
                    - type: number
                    - type: 'null'
                unlicensedMinimumSeatsBilled:
                  description: >-
                    Minimum number of unlicensed seats billed during one billing
                    period. Required when `pricingMode` is `per_licence`; must
                    be `null` when `pricingMode` is `flat_rate`.
                  anyOf:
                    - type: integer
                      minimum: 0
                      maximum: 9007199254740991
                    - type: 'null'
                licenses:
                  description: >-
                    Priced contract lines, one entry per SaaS license. Required
                    when `pricingMode` is `per_licence`; all `pricePerSeat` and
                    `minimumSeatsBilled` values must be `null` when
                    `pricingMode` is `flat_rate`. The list must exactly match
                    the licenses defined in the SaaS (same `id` for every
                    entry).
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        description: >-
                          License identifier used to map this priced contract
                          line to a SaaS license.
                        type: string
                      pricePerSeat:
                        description: >-
                          Price billed per seat for one billing period defined
                          by `billingFrequency`. Not annualized. Required when
                          `pricingMode` is `per_licence`; must be `null` when
                          `pricingMode` is `flat_rate`.
                        anyOf:
                          - type: number
                          - type: 'null'
                      minimumSeatsBilled:
                        description: >-
                          Minimum number of seats billed for this license during
                          one billing period. Required when `pricingMode` is
                          `per_licence`; must be `null` when `pricingMode` is
                          `flat_rate`.
                        anyOf:
                          - type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          - type: 'null'
                    required:
                      - id
                      - pricePerSeat
                      - minimumSeatsBilled
                    additionalProperties: false
              required:
                - pricingMode
                - currency
                - billingFrequency
                - flatRatePrice
                - unlicensedPricePerSeat
                - unlicensedMinimumSeatsBilled
                - licenses
              additionalProperties: false
            - type: 'null'
        finance:
          type: object
          description: Derived financial metrics computed from the configured contract.
          properties:
            yearlyCost:
              description: Total SaaS cost annualized from the contract billing frequency.
              anyOf:
                - type: number
                - type: 'null'
            unusedYearlyCost:
              description: >-
                Annualized cost of billed but unused seats derived from the
                current contract configuration.
              anyOf:
                - type: number
                - type: 'null'
            unusedSeatsCount:
              description: >-
                Number of billed seats currently unused based on the contract
                minimums and assigned identities.
              anyOf:
                - type: integer
                  minimum: 0
                  maximum: 9007199254740991
                - type: 'null'
          required:
            - yearlyCost
            - unusedYearlyCost
            - unusedSeatsCount
          additionalProperties: false
        licenses:
          type: array
          description: >-
            SaaS license catalog — all available licenses for this SaaS
            application.
          items:
            type: object
            properties:
              id:
                description: >-
                  License identifier used to map a SaaS license to a priced
                  contract line.
                type: string
              name:
                description: Human-readable license name.
                type: string
            required:
              - id
              - name
            additionalProperties: false
        groups:
          type: array
          description: >-
            All groups available in this SaaS application. Use `id` when
            provisioning.
          items:
            type: object
            properties:
              id:
                description: >-
                  Identifier of this group in the SaaS application. Use when
                  provisioning to assign the employee to the correct group.
                type: string
              name:
                description: Human-readable group name.
                type: string
            required:
              - id
              - name
            additionalProperties: false
        roles:
          type: array
          description: >-
            All roles available in this SaaS application. Use `id` when
            provisioning.
          items:
            type: object
            properties:
              id:
                description: >-
                  Identifier of this role in the SaaS application. Use when
                  provisioning to assign the correct role.
                type: string
              name:
                description: Human-readable role name.
                type: string
              description:
                description: Optional description of the role.
                anyOf:
                  - type: string
                  - type: 'null'
            required:
              - id
              - name
              - description
            additionalProperties: false
        organizationUnits:
          type: array
          description: >-
            All organization units available in this SaaS application. Use `id`
            when provisioning.
          items:
            type: object
            properties:
              id:
                description: >-
                  Identifier of this organization unit in the SaaS application.
                  Use when provisioning to assign the correct unit.
                type: string
              name:
                description: Human-readable organization unit name.
                type: string
            required:
              - id
              - name
            additionalProperties: false
      required:
        - contract
        - finance
        - licenses
        - groups
        - roles
        - organizationUnits
      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>`.

````