# Create a new production session Opens a new production session for a specific project, sector, and day. Requires JWT token authentication in the Authorization header. Key features: - Automatically resolves company context from authenticated user - Resolves project timezone for day normalization - Ensures uniqueness: only one open session per (company, project, day, sector) - Supports custom pricing, bonuses, and duration settings - Defaults are inherited from project configuration if not provided Endpoint: POST /api/control/production/sessions Version: 2.0.0 Security: bearerAuth ## Request fields (application/json): - `auth0Id` (string, required) User identifier (internal use, derived from JWT token) Example: "user_123456789" - `projectId` (string, required) Project identifier Example: "proj_123" - `openedAt` (string, required) Session opening timestamp in ISO 8601 UTC format (will be normalized to project timezone for day calculation) Example: "2025-10-19T08:00:00.000Z" - `sectorId` (string, required) Sector identifier Example: "sector_001" - `sector_name` (string, required) Sector name Example: "Lote A-1" - `samplingUnit` (string) Unit of measurement (defaults to project setting) Example: "box" - `pricePerUnit` (number) Price per unit (defaults to project setting) Example: 5.5 - `bonus` (object) - `bonus.type` (string, required) Bonus type (flat amount or percentage) Enum: "flat", "percent" - `bonus.value` (number, required) Bonus value (0-100 for percent, any positive for flat) Example: 10 - `bonus.note` (string) Optional note about the bonus Example: "High quality bonus" - `maxDurationHours` (integer) Maximum session duration in hours (defaults to 12) Example: 12 - `notes` (string) Optional notes Example: "Good weather today" ## Response 201 fields (application/json): - `status` (string) Example: "success" - `data` (object) - `data.sessionId` (string) Session unique identifier Example: "6507f1e3c9d8e2a4b1f9c3d5" - `data.companyId` (string) Company identifier Example: "comp_12345" - `data.projectId` (string) Project identifier Example: "proj_123" - `data.auth0Id` (string) User identifier who opened the session Example: "user_123456789" - `data.sectorId` (string) Sector identifier Example: "sector_001" - `data.sector_name` (string) Sector name Example: "Lote A-1" - `data.timezone` (string) Project timezone Example: "America/Mexico_City" - `data.day` (string) Session day (normalized to start of day in project timezone) Example: "2025-10-19T00:00:00.000Z" - `data.status` (string) Session status Enum: "open", "closed" - `data.openedAt` (string) Timestamp when the session was opened (ISO 8601 UTC) Example: "2025-10-19T08:00:00.000Z" - `data.closedAt` (string,null) When the session was closed (null if still open) - `data.maxDurationHours` (integer) Maximum duration in hours Example: 12 - `data.samplingUnit` (string) Unit of measurement (e.g., box, kg, ton) Example: "box" - `data.pricePerUnit` (number) Price per unit Example: 5.5 - `data.bonus` (object) - `data.bonus.type` (string, required) Bonus type (flat amount or percentage) Enum: "flat", "percent" - `data.bonus.value` (number, required) Bonus value (0-100 for percent, any positive for flat) Example: 10 - `data.bonus.note` (string) Optional note about the bonus Example: "High quality bonus" - `data.totals` (object) - `data.totals.totalUnits` (number) Total units recorded in this session Example: 150 - `data.notes` (string) Optional notes about the session Example: "Good weather conditions" ## Response 400 fields (application/json): - `status` (string) Example: "error" - `message` (string) Example: "Error message description" - `error` (string) Example: "Detailed error information" ## Response 401 fields (application/json): - `status` (string) Example: "error" - `message` (string) Example: "Error message description" - `error` (string) Example: "Detailed error information" ## Response 409 fields (application/json): - `status` (string) Example: "error" - `message` (string) Example: "Error message description" - `error` (string) Example: "Detailed error information" ## Response 500 fields (application/json): - `status` (string) Example: "error" - `message` (string) Example: "Error message description" - `error` (string) Example: "Detailed error information"