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

# Get phytosanitary monitoring summary

> Retrieves aggregated phytosanitary data for a company, project, or
sector within a date range.

Requires API token authentication with the `read:phytosanitary` scope:
`Authorization: Bearer <keyId>.<token>`.




## OpenAPI

````yaml /openapi.yaml get /api/control/phytosanitary/summary
openapi: 3.0.3
info:
  title: Hydrobit B2B API
  version: 2.0.0
  description: |
    Public B2B API documentation for Harvest and Phytosanitary data.

    All endpoints require a scoped API token sent in the `Authorization` header:
    `Bearer <keyId>.<token>`.

    API access is available for Corporate accounts. For access or support,
    contact support@hydrobit.ag.
  contact:
    name: Hydrobit Support
    url: https://hydrobit.ag
    email: support@hydrobit.ag
  license:
    name: Proprietary
    url: https://www.hydrobit.ag/terms-conditions
servers:
  - url: https://api.hydrobit.ag
    description: Production server
security:
  - apiTokenAuth: []
tags:
  - name: Harvest
    description: >-
      External B2B endpoints for harvest production sessions and per-worker
      breakdowns.
  - name: Phytosanitary
    description: External B2B endpoints for phytosanitary monitoring and analysis.
paths:
  /api/control/phytosanitary/summary:
    get:
      tags:
        - Phytosanitary
      summary: Get phytosanitary monitoring summary
      description: |
        Retrieves aggregated phytosanitary data for a company, project, or
        sector within a date range.

        Requires API token authentication with the `read:phytosanitary` scope:
        `Authorization: Bearer <keyId>.<token>`.
      operationId: getPhytosanitarySummary
      parameters:
        - name: companyId
          in: query
          required: false
          description: Company filter. Must match the token's company.
          schema:
            type: string
          example: comp_12345
        - name: projectId
          in: query
          required: false
          description: Project filter. Must belong to the token's company.
          schema:
            type: string
          example: proj_123
        - name: sectorId
          in: query
          required: false
          description: Sector filter. Must belong to the token's company.
          schema:
            type: string
          example: sector_001
        - name: startTime
          in: query
          required: true
          description: Start date in YYYY-MM-DD format.
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          example: '2026-06-01'
        - name: endTime
          in: query
          required: true
          description: End date in YYYY-MM-DD format.
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          example: '2026-06-15'
      responses:
        '200':
          description: Phytosanitary summary retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhytosanitarySummaryResponse'
        '400':
          description: Missing or invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, invalid, inactive, expired, or malformed API token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Insufficient scope or access denied for requested
            project/sector/company.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Invalid date range.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiTokenAuth: []
components:
  schemas:
    PhytosanitarySummaryResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
          example: success
        scope:
          type: string
          enum:
            - company
            - project
            - sector
          example: project
        range:
          $ref: '#/components/schemas/DateRange'
        projectTimezone:
          type: string
          example: America/Mexico_City
        filters:
          type: object
          properties:
            companyId:
              type: string
              nullable: true
              example: comp_12345
            projectId:
              type: string
              nullable: true
              example: proj_123
            sectorId:
              type: string
              nullable: true
              example: sector_001
        totalRecords:
          type: integer
          example: 42
        totalSectors:
          type: integer
          example: 3
        sectors:
          type: array
          items:
            $ref: '#/components/schemas/PhytosanitarySector'
        totalProjects:
          type: integer
          example: 2
        projects:
          type: array
          items:
            $ref: '#/components/schemas/PhytosanitaryProject'
    Error:
      type: object
      properties:
        error:
          type: string
          example: Internal server error
        message:
          type: string
          example: Detailed error message
    DateRange:
      type: object
      properties:
        startTime:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          example: '2026-06-01'
        endTime:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          example: '2026-06-15'
    PhytosanitarySector:
      type: object
      properties:
        sector_name:
          type: string
          example: Lote A-1
        incidence:
          type: number
          format: float
          example: 12.5
        severity:
          type: number
          format: float
          example: 18.3
        pests_diseases:
          type: array
          items:
            $ref: '#/components/schemas/PestDiseaseMetric'
    PhytosanitaryProject:
      type: object
      properties:
        projectId:
          type: string
          nullable: true
          example: proj_123
        projectName:
          type: string
          nullable: true
          example: Rancho San Pedro
        sectors:
          type: array
          items:
            $ref: '#/components/schemas/PhytosanitarySector'
    PestDiseaseMetric:
      type: object
      properties:
        pest_disease_name:
          type: string
          example: Aphids
        incidence:
          type: number
          format: float
          example: 15.5
        severity:
          type: number
          format: float
          example: 25
  securitySchemes:
    apiTokenAuth:
      type: http
      scheme: bearer
      bearerFormat: keyId.token
      description: |
        Scoped API token for external B2B endpoints. Send it in the
        `Authorization` header as `Bearer <keyId>.<token>`.

````