> ## 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.

# Production metrics over a date range

> Returns aggregate and per-day production counts (jobs completed/failed, units, print time) plus revenue from orders. Margin and cost breakdowns are never exposed. Revenue is reported only when neither printer_id nor product_id is set, since orders are not attributable to a specific printer or product at the order-row level.



## OpenAPI

````yaml /api-reference/openapi.json get /analytics/production
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:
  /analytics/production:
    get:
      tags:
        - Analytics
      summary: Production metrics over a date range
      description: >-
        Returns aggregate and per-day production counts (jobs completed/failed,
        units, print time) plus revenue from orders. Margin and cost breakdowns
        are never exposed. Revenue is reported only when neither printer_id nor
        product_id is set, since orders are not attributable to a specific
        printer or product at the order-row level.
      parameters:
        - schema:
            type: string
            description: >-
              Start of the reporting window (ISO date, e.g. 2026-01-01).
              Defaults to 30 days ago.
          required: false
          description: >-
            Start of the reporting window (ISO date, e.g. 2026-01-01). Defaults
            to 30 days ago.
          name: from
          in: query
        - schema:
            type: string
            description: End of the reporting window (ISO date). Defaults to today.
          required: false
          description: End of the reporting window (ISO date). Defaults to today.
          name: to
          in: query
        - schema:
            type: string
            description: Filter by printer ID
          required: false
          description: Filter by printer ID
          name: printer_id
          in: query
        - schema:
            type: string
            description: Filter by product ID
          required: false
          description: Filter by product ID
          name: product_id
          in: query
      responses:
        '200':
          description: Production report
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    $ref: '#/components/schemas/AnalyticsProduction'
                required:
                  - success
                  - data
        '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'
        '429':
          description: Rate limit exceeded (120 req/min/key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth:
            - read
components:
  schemas:
    AnalyticsProduction:
      type: object
      properties:
        date_range:
          type: object
          properties:
            from:
              type: string
            to:
              type: string
          required:
            - from
            - to
        summary:
          type: object
          properties:
            jobs_completed:
              type: number
            jobs_failed:
              type: number
            completion_rate:
              type: number
            units_produced:
              type: number
            total_print_time_hours:
              type: number
            revenue_cents:
              type: number
          required:
            - jobs_completed
            - jobs_failed
            - completion_rate
            - units_produced
            - total_print_time_hours
            - revenue_cents
        daily:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
              jobs_completed:
                type: number
              jobs_failed:
                type: number
              units_produced:
                type: number
              total_print_time_minutes:
                type: number
              revenue_cents:
                type: number
            required:
              - date
              - jobs_completed
              - jobs_failed
              - units_produced
              - total_print_time_minutes
              - revenue_cents
      required:
        - date_range
        - summary
        - daily
    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.

````