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

# Files that can be copied onto a purchase order

> The documents of the projects the order's lines belong to, and per line's baseline row its own documents and its spec item's docs-column files. Needs `purchase_orders_manage`.



## OpenAPI

````yaml /openapi.yaml get /purchase_orders/{purchase_order_id}/related_documents
openapi: 3.0.1
info:
  title: GetSpecs REST API
  description: REST API documentation for GetSpecs.
  version: 1.0.0
servers:
  - url: /v1
  - url: https://demo-api.getspecs.io/v1
security: []
paths:
  /purchase_orders/{purchase_order_id}/related_documents:
    get:
      tags:
        - ProcurementAttachment
      summary: Files that can be copied onto a purchase order
      description: >-
        The documents of the projects the order's lines belong to, and per
        line's baseline row its own documents and its spec item's docs-column
        files. Needs `purchase_orders_manage`.
      operationId: purchase_orders#related_documents
      parameters:
        - name: purchase_order_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/related_documents'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
        - apiKey: []
          workspaceId: []
components:
  schemas:
    related_documents:
      type: object
      description: >-
        What can be copied onto a purchase order or supplier invoice — only
        sources of its own lines.
      properties:
        projects:
          type: array
          description: >-
            The documents of the projects the document's lines belong to;
            projects without documents left out.
          items:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
              files:
                type: array
                items:
                  $ref: '#/components/schemas/related_document'
            required:
              - id
              - name
              - files
        items:
          type: array
          description: >-
            Per baseline row of the document's lines (an invoice's own and those
            of the order lines it bills), in line order, its own documents and
            its spec item's docs-column files; rows without files left out.
          items:
            type: object
            properties:
              baseline_item_id:
                type: integer
              project_id:
                type: integer
              identifier:
                type: string
                nullable: true
                description: Null when the role can't see it.
              name:
                type: string
                nullable: true
                description: Null when the role can't see it.
              files:
                type: array
                items:
                  $ref: '#/components/schemas/related_document'
              project_item_documents:
                type: array
                items:
                  type: object
                  properties:
                    column_slug:
                      type: string
                    column_name:
                      type: string
                    files:
                      type: array
                      items:
                        $ref: '#/components/schemas/related_document'
                  required:
                    - column_slug
                    - column_name
                    - files
            required:
              - baseline_item_id
              - project_id
              - identifier
              - name
              - files
              - project_item_documents
      required:
        - projects
        - items
    error:
      type: object
      properties:
        error:
          type: string
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                nullable: true
              code:
                type: string
                nullable: true
              message:
                type: string
            required:
              - message
    related_document:
      type: object
      description: >-
        A document related to a purchase order or supplier invoice, which can be
        copied onto it (`attachments/copy`).
      properties:
        document_type:
          type: string
          enum:
            - project_document
            - baseline_document
            - project_item_document
        document_id:
          type: integer
          description: An attachment id, or an item file id for `project_item_document`.
        filename:
          type: string
        content_type:
          type: string
        byte_size:
          type: integer
          nullable: true
          description: Not known for docs-column files.
        url:
          type: string
      required:
        - document_type
        - document_id
        - filename
        - content_type
        - url
  securitySchemes:
    apiKey:
      type: apiKey
      name: authorization
      in: header
    workspaceId:
      type: apiKey
      name: X-Workspace-ID
      in: header

````

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