agrio Diagnose API

Plant disease and pest diagnosis from images.

OpenAPI Specification

agrio-diagnose-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Agrio Agriculture Balance Diagnose API
  description: With Agrio APIs, you can access data on weather patterns, pest and disease predictions, image-based plant diagnosis, and satellite vegetation monitoring to build accurate crop advisory tools. Agrio is a precision plant protection solution that helps growers and crop advisors forecast, identify, and treat plant diseases, pests, and nutrient deficiencies.
  version: 1.0.0
  contact:
    email: info@saillog.co
    url: https://agrio.app
  x-last-validated: '2026-04-19'
servers:
- url: https://agrio-api-gateway-6it0wqn1.uc.gateway.dev
  description: Production server.
security:
- BearerAuth: []
tags:
- name: Diagnose
  description: Plant disease and pest diagnosis from images.
paths:
  /v1/diagnose:
    post:
      summary: Agrio Diagnose Plant
      description: Analyzes an uploaded plant image using AI computer vision to identify diseases, pests, and nutrient deficiencies. Returns a ranked list of diagnoses with confidence scores, common and scientific names, and treatment recommendations. One credit is consumed per diagnosis request.
      operationId: getDiagnosis
      tags:
      - Diagnose
      parameters:
      - name: Authorization
        in: header
        description: Bearer token for API authentication.
        required: true
        schema:
          type: string
          example: Bearer YOUR_API_KEY
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DiagnoseRequest'
            examples:
              GetDiagnosisRequestExample:
                summary: Default getDiagnosis request
                x-microcks-default: true
                value:
                  crop_id: tomato
                  image: <binary image data>
      responses:
        '200':
          description: Diagnosis results with ranked disease/pest identifications.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Diagnosis'
              examples:
                GetDiagnosis200Example:
                  summary: Default getDiagnosis 200 response
                  x-microcks-default: true
                  value:
                    crop: tomato
                    cropConfidence: high
                    idArray:
                    - id: early_blight
                      confidence: 0.87
                      commonName: Early Blight
                      scientificName: Alternaria solani
                    - id: late_blight
                      confidence: 0.09
                      commonName: Late Blight
                      scientificName: Phytophthora infestans
                    - id: septoria_leaf_spot
                      confidence: 0.04
                      commonName: Septoria Leaf Spot
                      scientificName: Septoria lycopersici
        '400':
          description: Bad request. Invalid image or missing parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized. Invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Insufficient credits. Account balance is zero.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    DiagnoseRequest:
      type: object
      title: Diagnose Request
      description: Image and crop context for plant disease diagnosis.
      properties:
        crop_id:
          type: string
          description: Crop identifier from the supported crops list.
          example: tomato
        image:
          type: string
          format: binary
          description: Plant image file for diagnosis (JPEG or PNG).
      required:
      - crop_id
      - image
    DiagnosisResult:
      type: object
      title: Diagnosis Result
      description: A single disease or pest identification result.
      properties:
        id:
          type: string
          description: Unique identifier for the disease or pest.
          example: early_blight
        confidence:
          type: number
          format: double
          description: Confidence score for this diagnosis (0.0 to 1.0).
          example: 0.87
        commonName:
          type: string
          description: Common name of the disease or pest.
          example: Early Blight
        scientificName:
          type: string
          description: Scientific name of the disease or pest.
          example: Alternaria solani
      required:
      - id
      - confidence
      - commonName
      - scientificName
    ErrorResponse:
      type: object
      title: Error Response
      description: Standard error response.
      properties:
        error:
          type: string
          description: Error code or type.
          example: unauthorized
        message:
          type: string
          description: Human-readable error message.
          example: Invalid or missing API key.
        status:
          type: integer
          description: HTTP status code.
          example: 401
    Diagnosis:
      type: object
      title: Diagnosis
      description: Complete plant diagnosis result including crop identification and ranked disease list.
      properties:
        crop:
          type: string
          description: Identified or confirmed crop type.
          example: tomato
        cropConfidence:
          type: string
          description: Confidence level for crop identification (high, medium, low).
          example: high
        idArray:
          type: array
          description: Ranked list of disease/pest diagnoses sorted by confidence descending.
          items:
            $ref: '#/components/schemas/DiagnosisResult'
      required:
      - crop
      - cropConfidence
      - idArray
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key obtained from the Agrio API portal at pro.agrio.app/image-diagnosis-api. Include as a Bearer token in the Authorization header.