> ## 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 raw phytosanitary records for the authenticated company

> Retrieves individual phytosanitary records for the authenticated
token's company 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/company-records
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/company-records:
    get:
      tags:
        - Phytosanitary
      summary: Get raw phytosanitary records for the authenticated company
      description: |
        Retrieves individual phytosanitary records for the authenticated
        token's company within a date range.

        Requires API token authentication with the `read:phytosanitary` scope:
        `Authorization: Bearer <keyId>.<token>`.
      operationId: getPhytosanitaryCompanyRecords
      parameters:
        - 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: Company phytosanitary records retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhytosanitaryRecordResponse'
        '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.
          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:
    PhytosanitaryRecordResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
          example: success
        range:
          $ref: '#/components/schemas/DateRange'
        companyTimezone:
          type: string
          example: America/Monterrey
        companyId:
          type: string
          example: comp_12345
        totalRecords:
          type: integer
          example: 3
        records:
          type: array
          items:
            type: object
            properties:
              record_id:
                type: string
                example: rec_abc123
              created_at:
                type: string
                format: date-time
                example: '2026-06-05T14:30:00.000Z'
              record_time:
                type: string
                format: date-time
                nullable: true
                example: '2026-06-05T14:25:00.000Z'
              user_id:
                type: string
                example: user_789
              user_name:
                type: string
                example: Juan Perez
              projectId:
                type: string
                nullable: true
                example: proj_123
              project_name:
                type: string
                nullable: true
                example: Rancho San Pedro
              sectorId:
                type: string
                nullable: true
                example: sector_001
              sector_name:
                type: string
                nullable: true
                example: Lote A-1
              crop:
                type: string
                nullable: true
                example: Blueberry
              variety:
                type: string
                nullable: true
                example: Biloxi
              latitude:
                type: number
                nullable: true
                example: 19.4326
              longitude:
                type: number
                nullable: true
                example: -99.1332
              responses:
                type: array
                items:
                  type: object
                  properties:
                    response_id:
                      type: string
                      example: resp_001
                    variable_name:
                      type: string
                      example: aphids
                    variable_type:
                      type: string
                      example: pest
                    name:
                      type: string
                      example: Aphids
                    value_number:
                      type: number
                      nullable: true
                      example: 12
                    severity:
                      type: number
                      nullable: true
                      example: 3
    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'
  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>`.

````