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

# Add attachments to a payroll line item

> Creates attachment metadata records for a payroll line item and returns pre-signed S3 URLs for uploading the files. The client should first send attachment metadata (filename, contentType, fileSize) in this request, then use the returned pre-signed URLs to upload files directly to S3.



## OpenAPI

````yaml /api-reference/specs/pay-api.yaml post /payroll/line/{employeeId}/{lineId}/attachments
openapi: 3.0.3
info:
  title: FlowPayroll API
  description: >-
    API for payroll management, including payroll upload, lock, HMRC submission,
    employee management
  version: 0.1.0
servers:
  - url: https://api.sandbox.flowpayroll.ai/v1
security:
  - XAuthToken: []
    XOrgId: []
tags:
  - name: Employees
    description: >-
      Create, retrieve, update, and delete employee records, and look them up by
      NI number or payroll ID.
  - name: Starters & leavers
    description: Set and clear starter and leaver details, individually or in bulk.
  - name: Tax codes
    description: >-
      Manage employee tax codes and query the effective tax code and NI category
      on a given date.
  - name: NI & identifiers
    description: Manage NI categories, National Insurance numbers, and payroll IDs.
  - name: Student loans
    description: Start and end student and postgraduate loans.
  - name: Payroll setup
    description: Assign an employee's payroll config and set opening balances.
  - name: Payroll
  - name: Payroll lines
  - name: PayrollConfig
  - name: Pay Elements
  - name: Calculator
  - name: Payslip
  - name: RTI
  - name: YearEnd
  - name: Organisation
paths:
  /payroll/line/{employeeId}/{lineId}/attachments:
    post:
      tags:
        - Payroll lines
      summary: Add attachments to a payroll line item
      description: >-
        Creates attachment metadata records for a payroll line item and returns
        pre-signed S3 URLs for uploading the files. The client should first send
        attachment metadata (filename, contentType, fileSize) in this request,
        then use the returned pre-signed URLs to upload files directly to S3.
      operationId: AddPayrollLineItemAttachments
      parameters:
        - name: employeeId
          in: path
          required: true
          schema:
            type: string
          description: The ID of the employee
        - name: lineId
          in: path
          required: true
          schema:
            type: string
          description: The ID of the payroll line item
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddPayrollLineItemAttachmentsRequestDto'
      responses:
        '200':
          description: Attachment upload URLs generated successfully
          content:
            application/json:
              schema:
                type: object
                allOf:
                  - $ref: '#/components/schemas/ResponseBody'
                  - properties:
                      content:
                        type: object
                        properties:
                          data:
                            type: array
                            items:
                              $ref: '#/components/schemas/AttachmentUploadResponseDto'
        '400':
          description: Invalid request or no attachments provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseBody'
        '404':
          description: Payroll Line Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseBody'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseBody'
components:
  schemas:
    AddPayrollLineItemAttachmentsRequestDto:
      type: object
      required:
        - attachments
      properties:
        attachments:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/CreateAttachmentRequestDto'
          description: The collection of attachment metadata to add
    ResponseBody:
      type: object
      properties:
        message:
          $ref: '#/components/schemas/MessageWithTokenResponse'
        content:
          type: object
          properties:
            data:
              type: object
              nullable: true
            metadata:
              type: object
              nullable: true
              properties:
                dateFormat:
                  type: string
                  default: yyyy-MM-dd
                dateTimeFormat:
                  type: string
                  default: yyyy-MM-ddTHH:mm:ss.fffZ
                paginationToken:
                  type: string
                  nullable: true
        validationIssues:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssue'
        messageToken:
          type: string
    AttachmentUploadResponseDto:
      type: object
      properties:
        attachmentId:
          type: string
          description: The unique identifier for the attachment
        filename:
          type: string
          description: The original filename of the attachment
        uploadUrl:
          type: string
          format: uri
          description: Pre-signed PUT URL for uploading the file to S3
        expiresAt:
          type: string
          format: date-time
          description: The expiration date/time of the upload URL (ISO 8601 format)
    CreateAttachmentRequestDto:
      type: object
      required:
        - filename
        - contentType
        - fileSize
      properties:
        filename:
          type: string
          description: The original filename of the attachment
          example: invoice.pdf
        contentType:
          type: string
          description: The MIME type of the file (e.g., application/pdf, image/jpeg)
          example: application/pdf
        fileSize:
          type: integer
          format: int64
          description: The size of the file in bytes
          example: 102400
    MessageWithTokenResponse:
      type: object
      properties:
        text:
          type: string
        token:
          type: string
        tokenArguments:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssueArgument'
    ValidationIssue:
      type: object
      description: >
        Field validation item. `reasonToken` is a stable snake_case key for i18n
        or custom client messages; `reason` is the default English text from the
        API.
      properties:
        field:
          type: string
          description: Dot-path of the field (e.g. name.firstName, address.line1).
        reason:
          type: string
          description: Default human-readable message.
        reasonToken:
          type: string
          description: Machine-readable error identifier (snake_case).
        reasonTokenArguments:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/ValidationIssueArgument'
    ValidationIssueArgument:
      type: object
      properties:
        name:
          type: string
        value:
          type: string
  securitySchemes:
    XAuthToken:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: Access token obtained from OAuth2 client credentials flow
    XOrgId:
      type: apiKey
      in: header
      name: X-Org-Id
      description: >-
        Organisation to scope the request to. Required when the principal can
        access more than one organisation; optional for single-organisation
        principals (the authorizer resolves it automatically).

````