> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erp.arukz.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update purchase agreement

> Update an existing purchase agreement and sync lines

Also accepts `PATCH` with the same body.



## OpenAPI

````yaml /api-reference/openapi.json put /admin/api/v1/purchases/purchase-agreements/{id}
openapi: 3.0.3
info:
  title: ARUKZ ERP API
  version: v1
  description: >-
    The REST API of ARUKZ ERP: sales, purchases, inventory, products, partners,
    accounts, projects and reference data. Every call acts as the user whose
    token it carries and sees only that user's company.
servers:
  - url: https://erp.arukz.com
    description: ARUKZ ERP (hosted)
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Sign in for a token and sign out.
  - name: Sales
    description: Quotations, sales orders and their lines, deliveries and invoices.
  - name: Purchases
    description: Purchase orders, receipts, bills, agreements and vendor price lists.
  - name: Inventory
    description: >-
      Warehouses, locations, lots, stock quantities, receipts, deliveries,
      transfers and scrap.
  - name: Products
    description: 'The product catalogue: categories, attributes, variants and packaging.'
  - name: Partners
    description: Customers, vendors, contacts, addresses and bank accounts.
  - name: Accounts
    description: >-
      Invoices, bills, credit notes, refunds, taxes, journals and the chart of
      accounts.
  - name: Projects
    description: Projects, tasks, stages and milestones.
  - name: Reference data
    description: Currencies and rates, banks, countries, states and units of measure.
paths:
  /admin/api/v1/purchases/purchase-agreements/{id}:
    put:
      tags:
        - Purchases
      summary: Update purchase agreement
      description: |-
        Update an existing purchase agreement and sync lines

        Also accepts `PATCH` with the same body.
      operationId: purchases-purchase-agreements-update-purchase-agreement
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            description: The purchase agreement ID
            example: 1
          description: The purchase agreement ID
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                partner_id:
                  type: integer
                  description: >-
                    Vendor partner ID. The `id` of an existing record in the
                    partners_partners table.
                  example: 12
                type:
                  type: string
                  description: 'Agreement type: blanket_order or purchase_template.'
                  enum:
                    - blanket_order
                    - purchase_template
                  example: blanket_order
                currency_id:
                  type: integer
                  description: >-
                    Currency ID. The `id` of an existing record in the
                    currencies table.
                  example: 1
                company_id:
                  type: integer
                  description: >-
                    Company ID. The `id` of an existing record in the companies
                    table.
                  example: 1
                user_id:
                  type: integer
                  description: >-
                    Buyer user ID. The `id` of an existing record in the users
                    table.
                  nullable: true
                  example: 2
                starts_at:
                  type: string
                  description: >-
                    Agreement validity start date (YYYY-MM-DD). Must be a valid
                    date. Must be a date after or equal to `today`.
                  nullable: true
                  example: '2026-02-20'
                ends_at:
                  type: string
                  description: >-
                    Agreement validity end date (YYYY-MM-DD). Must be a valid
                    date. Must be a date after or equal to `starts_at`.
                  nullable: true
                  example: '2026-08-20'
                reference:
                  type: string
                  description: Reference text. Must not be greater than 255 characters.
                  nullable: true
                  example: AG-2026-Q1
                description:
                  type: string
                  description: Terms and conditions / notes.
                  nullable: true
                  example: Blanket agreement for monthly supply.
                lines:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: >-
                          The `id` of an existing record in the
                          purchases_requisition_lines table.
                        nullable: true
                        example: 16
                      product_id:
                        type: integer
                        description: >-
                          The `id` of an existing record in the
                          products_products table.
                        example: 16
                      qty:
                        type: number
                        description: >-
                          Must be at least 0. Must not be greater than
                          99999999999.
                        example: 22
                      uom_id:
                        type: integer
                        description: >-
                          The `id` of an existing record in the unit_of_measures
                          table.
                        nullable: true
                        example: 16
                      price_unit:
                        type: number
                        description: >-
                          Must be at least 0. Must not be greater than
                          99999999999.
                        example: 22
                    required:
                      - price_unit
                      - product_id
                      - qty
                  description: >-
                    Array of agreement lines with writable fields from the
                    purchase agreement form. Must have at least 1 items.
                  example:
                    - product_id: 101
                      qty: 100
                      uom_id: 1
                      price_unit: 70
      responses:
        '200':
          description: Success
          content:
            application/json:
              example:
                data:
                  id: null
                  name: PA-7365
                  type: blanket_order
                  state: draft
                  reference: null
                  starts_at: null
                  ends_at: null
                  description: null
                  currency_id: 791
                  partner_id: 1
                  user_id: null
                  company_id: 1398
                  creator_id: 1
                  created_at: null
                  updated_at: null
                  deleted_at: null
                message: Purchase agreement updated successfully.
        '401':
          description: Unauthenticated
          content:
            application/json:
              example:
                message: Unauthenticated.
        '404':
          description: Purchase agreement not found
          content:
            application/json:
              example:
                message: Resource not found.
        '422':
          description: Validation error
          content:
            application/json:
              example:
                message: The given data was invalid.
                errors:
                  partner_id:
                    - The partner id field must be an integer.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API token from [Sign in](/api-reference/authentication), sent as
        `Authorization: Bearer <token>`. Tokens last 30 days.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.