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

# Mark a print job completed

> Marks the job `completed`. **Side effect:** adjusts `finished_goods.current_stock` and `quantity_needs_assembly` per the job's `product_sku_id` and `requires_assembly` flags, then emits a `job_completed` event onto the `PRINT_EVENTS` queue for downstream processing (inventory, revenue).



## OpenAPI

````yaml /api-reference/openapi.json post /jobs/{id}/complete
openapi: 3.1.0
info:
  title: AutoPrintFarm Public API
  version: 1.0.0
  description: >-
    Public API for AutoPrintFarm — read + write surface for printers, jobs,
    inventory, orders, SKUs, files, worklist, and assembly. Authorization uses
    three scopes: `read` (any list/get), `write` (data mutations — create,
    update, delete, uploads, fulfillment), and `control` (physical printer
    actions: start, pause, resume, stop, heaters, light, filament). Authenticate
    with an API key minted from Settings → API Keys in the AutoPrintFarm
    dashboard.
  contact:
    name: AutoPrintFarm
    url: https://autoprintfarm.com
servers:
  - url: https://api.autoprintfarm.com/public/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Printers
    description: Printer fleet status
  - name: Jobs
    description: Print job queue and history
  - name: Inventory
    description: Finished-goods stock levels
  - name: Orders
    description: Customer orders and line items
  - name: Wiki
    description: Internal documentation articles
  - name: Worklist
    description: Operational task queue
  - name: Products
    description: Product catalog, SKUs, components, and color presets
  - name: Files
    description: Print file metadata and versions
  - name: Hubs
    description: Hub fleet and connection status
  - name: Assembly
    description: Post-print assembly tasks with bundled wiki
  - name: Materials
    description: Filament, components, packaging, and printer parts inventory
  - name: Analytics
    description: >-
      Dashboard rollups and reporting (overview, production, printers, failures,
      inventory, revenue)
paths:
  /jobs/{id}/complete:
    post:
      tags:
        - Jobs
      summary: Mark a print job completed
      description: >-
        Marks the job `completed`. **Side effect:** adjusts
        `finished_goods.current_stock` and `quantity_needs_assembly` per the
        job's `product_sku_id` and `requires_assembly` flags, then emits a
        `job_completed` event onto the `PRINT_EVENTS` queue for downstream
        processing (inventory, revenue).
      parameters:
        - schema:
            type: string
          required: true
          name: id
          in: path
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                actual_print_time_minutes:
                  type: integer
                  exclusiveMinimum: 0
                  description: >-
                    Override the elapsed print time in minutes. When omitted,
                    the server computes it from `time_started`.
      responses:
        '200':
          description: Completed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    $ref: '#/components/schemas/PrintJobDetail'
                required:
                  - success
                  - data
        '400':
          description: Validation or business-rule error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, invalid, revoked, or expired API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: API key lacks the required scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict — concurrent state change or duplicate
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded (120 req/min/key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth:
            - write
components:
  schemas:
    PrintJobDetail:
      type: object
      properties:
        id:
          type: string
        status:
          type:
            - string
            - 'null'
        printer_id:
          type:
            - string
            - 'null'
        product_id:
          type:
            - string
            - 'null'
        product_sku_id:
          type:
            - string
            - 'null'
        product_name:
          type:
            - string
            - 'null'
        file_name:
          type: string
        number_of_units:
          type: number
        color:
          type: string
        filament_type:
          type: string
        material_type:
          type: string
        progress_percentage:
          type:
            - number
            - 'null'
        estimated_print_time_minutes:
          type:
            - number
            - 'null'
        actual_print_time_minutes:
          type:
            - number
            - 'null'
        failure_reason:
          type:
            - string
            - 'null'
        time_submitted:
          type:
            - string
            - 'null'
        time_started:
          type:
            - string
            - 'null'
        time_completed:
          type:
            - string
            - 'null'
        created_at:
          type:
            - string
            - 'null'
        updated_at:
          type:
            - string
            - 'null'
        filament_needed_grams:
          type:
            - number
            - 'null'
        printer_name:
          type:
            - string
            - 'null'
        printer_model:
          type:
            - string
            - 'null'
        sku_name:
          type:
            - string
            - 'null'
      required:
        - id
        - status
        - printer_id
        - product_id
        - product_sku_id
        - product_name
        - file_name
        - number_of_units
        - color
        - filament_type
        - material_type
        - progress_percentage
        - estimated_print_time_minutes
        - actual_print_time_minutes
        - failure_reason
        - time_submitted
        - time_started
        - time_completed
        - created_at
        - updated_at
        - filament_needed_grams
        - printer_name
        - printer_model
        - sku_name
    Error:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Machine-readable error code (e.g. NOT_FOUND, VALIDATION_ERROR,
                FORBIDDEN, HUB_OFFLINE). Stable across releases — use this for
                branching.
              example: NOT_FOUND
            message:
              type: string
              description: >-
                Human-readable error message. May vary across releases — do not
                branch on this.
              example: Resource not found
            details:
              description: >-
                Optional structured detail. For VALIDATION_ERROR this is `{
                field: [messages] }`.
          required:
            - code
            - message
          description: Error detail object
      required:
        - success
        - error
      description: Standard error response envelope
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: apf_live_<64 hex>
      description: >-
        API keys are minted in the AutoPrintFarm web app under Settings → API
        Keys. Send as `Authorization: Bearer apf_live_...`. Keys are shown
        exactly once at creation and can be revoked at any time.

````