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

# Record weight and feed metrics for a flock Calculates daily rates and perform...

> Record weight and feed metrics for a flock Calculates daily rates and performance indicators IMPORTANT: Automatically accounts for mortality - feed per bird calculated only for living birds Body: { flockId: string, startWeightGrams: number, endWeightGrams: number, totalFeedConsumedKg: number, birdCount: number (optional, initial bird count), mortality: array of {date: ISO datetime, count: number} (optional, birds lost each day), feedType: string (optional), supplier: string (optional), measurementDate: ISO datetime (optional), notes: string (optional) } Example with mortality: { "flockId": "...", "startWeightGrams": 1200, "endWeightGrams": 1700, "totalFeedConsumedKg": 37000, "birdCount": 34000, "mortality": [ {"date": "2024-01-05T00:00:00Z", "count": 5}, {"date": "2024-01-10T00:00:00Z", "count": 2} ], "supplier": "Supplier A" } Result: Feed per bird calculated for 33,993 birds (34000 - 5 - 2), not 34000

**Required capabilities:** `create_movement`.



## OpenAPI

````yaml /openapi.json post /api/v1/inventory/metrics/weight-and-feed
openapi: 3.1.0
info:
  title: Poultry Farm Analytics API
  version: 2.0.0
  description: >-
    REST API for managing poultry farm inventory, flocks, cycles, analytics,
    anomalies, IoT devices, and operations. Most endpoints require a JWT bearer
    token; many additionally require specific capabilities (e.g.
    `view_analytics`, `manage_flocks`).
  contact:
    name: Poultry Farm API
    url: https://github.com/quader864/API-poultry-farm
servers:
  - url: http://localhost:3000
    description: Local development
  - url: https://api.example.com
    description: Production (replace with your deployment)
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: User signup, login, JWT verification, role management.
  - name: Dashboard
    description: Role-specific dashboard summaries.
  - name: Inventory
    description: Inventory movements for birds, feed and eggs.
  - name: Analytics V2
    description: >-
      Unified analytics: daily, cycle, breed, predictions, anomalies,
      financials.
  - name: Flock Analytics
    description: Per-flock analytics summary and metrics.
  - name: Rules
    description: Analytics rule engine.
  - name: Configuration
    description: Analytics configuration management.
  - name: Anomalies
    description: Detected anomalies and hypotheses.
  - name: Flocks
    description: Flock management.
  - name: Cycles
    description: Cycle-based inventory movements.
  - name: Schedules
    description: Feeding, vaccination, inspection schedules.
  - name: Predictive
    description: Failure forecasting and health predictions.
  - name: Compliance
    description: Compliance tracking.
  - name: Continuity
    description: Business continuity and disaster recovery.
  - name: Optimization
    description: Efficiency optimization and recommendations.
  - name: Sharing
    description: Resource sharing and transfers.
  - name: Operations
    description: Incident management.
  - name: Procurement
    description: 'Supply chain: orders and suppliers.'
  - name: IoT
    description: IoT devices and sensor data ingestion.
  - name: Scale
    description: Scale weight measurements.
  - name: Admin
    description: Admin control plane (admin-only).
paths:
  /api/v1/inventory/metrics/weight-and-feed:
    post:
      tags:
        - Inventory
      summary: >-
        Record weight and feed metrics for a flock Calculates daily rates and
        perform...
      description: >-
        Record weight and feed metrics for a flock Calculates daily rates and
        performance indicators IMPORTANT: Automatically accounts for mortality -
        feed per bird calculated only for living birds Body: { flockId: string,
        startWeightGrams: number, endWeightGrams: number, totalFeedConsumedKg:
        number, birdCount: number (optional, initial bird count), mortality:
        array of {date: ISO datetime, count: number} (optional, birds lost each
        day), feedType: string (optional), supplier: string (optional),
        measurementDate: ISO datetime (optional), notes: string (optional) }
        Example with mortality: { "flockId": "...", "startWeightGrams": 1200,
        "endWeightGrams": 1700, "totalFeedConsumedKg": 37000, "birdCount":
        34000, "mortality": [ {"date": "2024-01-05T00:00:00Z", "count": 5},
        {"date": "2024-01-10T00:00:00Z", "count": 2} ], "supplier": "Supplier A"
        } Result: Feed per bird calculated for 33,993 birds (34000 - 5 - 2), not
        34000


        **Required capabilities:** `create_movement`.
      operationId: post_api_v1_inventory_metrics_weight_and_feed
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              properties:
                flockId:
                  type: string
                  description: '`flockId` — see API source for exact type.'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    additionalProperties: true
        '400':
          description: Bad Request — validation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
        '401':
          description: Unauthorized — missing or invalid token
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '403':
          description: Forbidden — missing capability or unverified account
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT obtained from `POST /api/v1/auth/login`.

````