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

# Attach documents to an order

> Attach carton and pallet label PDFs to an existing order using multipart/form-data. The metadata field should be a stringified JSON array describing the files.



## OpenAPI

````yaml /openapi.json post /api/documents/{order_id}
openapi: 3.0.0
info:
  title: Authentication API
  description: API for user authentication and token generation
  version: 1.0.0
servers:
  - url: https://api.retailreadyai.com
    description: Production server
  - url: https://stg.retailreadyai.com
    description: Staging server
security: []
paths:
  /api/documents/{order_id}:
    post:
      tags:
        - Documents
      summary: Attach documents to an order
      description: >-
        Attach carton and pallet label PDFs to an existing order using
        multipart/form-data. The metadata field should be a stringified JSON
        array describing the files.
      parameters:
        - name: order_id
          in: path
          required: true
          schema:
            type: string
            description: The ID of the order to attach the documents to
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                metadata:
                  type: string
                  description: >-
                    Stringified JSON array describing the files to be uploaded.
                    Allowed types: packing_list, bill_of_lading, carton_labels,
                    pallet_labels, other. Only the files referenced in this
                    array are required in the form-data. Example:
                    [{"type":"packing_list","file_format":"PDF"},{"type":"carton_labels","file_format":"PDF"}]
                carton_labels:
                  type: string
                  format: binary
                  description: >-
                    PDF file for carton labels. Only required if referenced in
                    metadata.
                pallet_labels:
                  type: string
                  format: binary
                  description: >-
                    PDF file for pallet labels. Only required if referenced in
                    metadata.
                packing_list:
                  type: string
                  format: binary
                  description: >-
                    PDF file for packing list. Only required if referenced in
                    metadata.
                bill_of_lading:
                  type: string
                  format: binary
                  description: >-
                    PDF file for bill of lading. Only required if referenced in
                    metadata.
                other:
                  type: string
                  format: binary
                  description: >-
                    PDF file for other document type. Only required if
                    referenced in metadata.
              required:
                - metadata
            encoding:
              carton_labels:
                contentType: application/pdf
              pallet_labels:
                contentType: application/pdf
            example:
              metadata: >-
                [{"type":"carton_labels","file_format":"PDF"},{"type":"pallet_labels","file_format":"PDF"}]
              carton_labels: '@/path/to/carton_labels.pdf'
              pallet_labels: '@/path/to/pallet_labels.pdf'
          application/json:
            schema:
              type: object
              properties:
                metadata:
                  type: string
                  description: >-
                    Stringified JSON array describing the files to be uploaded.
                    Allowed types: packing_list, bill_of_lading, carton_labels,
                    pallet_labels, other. Only the files referenced in this
                    array are required in the JSON. Example:
                    [{"type":"packing_list","file_format":"base64"},{"type":"carton_labels","file_format":"base64"}]
                carton_labels:
                  type: string
                  description: >-
                    Base64-encoded string for carton labels. Only required if
                    referenced in metadata.
                pallet_labels:
                  type: string
                  description: >-
                    Base64-encoded string for pallet labels. Only required if
                    referenced in metadata.
                packing_list:
                  type: string
                  description: >-
                    Base64-encoded string for packing list. Only required if
                    referenced in metadata.
                bill_of_lading:
                  type: string
                  description: >-
                    Base64-encoded string for bill of lading. Only required if
                    referenced in metadata.
                other:
                  type: string
                  description: >-
                    Base64-encoded string for other document type. Only required
                    if referenced in metadata.
              required:
                - metadata
            example:
              metadata: >-
                [{"type":"packing_list","file_format":"base64"},{"type":"carton_labels","file_format":"base64"}]
              carton_labels: JVBERi0xLjQKJcfs...
              packing_list: JVBERi0xLjQKJcfs...
      responses:
        '200':
          description: Successfully uploaded documents
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Success message
              example:
                message: Documents uploaded successfully
        '400':
          description: Bad request - missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  error:
                    type: object
                    description: Error Object
                    properties:
                      code:
                        type: string
                        description: Error code
              example:
                message: Invalid Request - Missing required fields
                error:
                  code: INVALID_REQUEST
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  error:
                    type: object
                    description: Error Object
                    properties:
                      code:
                        type: string
                        description: Error code
              example:
                message: Failed to upload documents
                error:
                  code: INTERNAL_SERVER_ERROR
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````