Canix Plant Batches API

The Plant Batches API from Canix — 2 operation(s) for plant batches.

OpenAPI Specification

canix-plant-batches-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Canix Plant Batches API
  x-logo:
    url: https://assets.website-files.com/5ee52a0f4be6ffc2aaeb52cd/5ee52a0f4be6ff20e7eb534f_canix-logo.svg
    backgroundColor: '#FFFFFF'
    altText: Canix logo
  description: '# Introduction

    This API documentation describes the endpoints used by third-party developers to get Canix data for their account.

    # Authentication

    Canix API uses API Keys for authentication. You can generate an API key on our [API page](https://app.canix.com/company/api), and on your API requests use the `X-API-KEY` header with the API key value you generated.

    We strongly recommend using a secrets manager. Plain text files like dotenv lead to accidental costly leaks. Use [Doppler](https://doppler.com/) or similar options for a developer friendly experience. AWS and Google Cloud have native solutions as well.'
  contact:
    name: Canix Support
    url: https://help.canix.com/
    email: help@canix.com
  version: 1.3.10
servers:
- url: https://api.canix.com/api/v1
  variables: {}
security:
- ApiKeyAuth: []
tags:
- name: Plant Batches
paths:
  /plant_batches:
    get:
      tags:
      - Plant Batches
      summary: GetPlantBatches
      description: Return active Plant Batches
      operationId: GetPlantBatches
      parameters:
      - $ref: '#/components/parameters/limitParam'
      - $ref: '#/components/parameters/offsetParam'
      - $ref: '#/components/parameters/orderByParam'
      - $ref: '#/components/parameters/whereParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PlantBatch'
        '400':
          $ref: '#/components/responses/400BadRequest'
        '401':
          $ref: '#/components/responses/401NotAuthenticated'
        '403':
          $ref: '#/components/responses/403AccessDenied'
        '404':
          $ref: '#/components/responses/404NotFound'
        '500':
          $ref: '#/components/responses/500ServerError'
  /plant_batches/{plant_batch_id}:
    get:
      tags:
      - Plant Batches
      summary: GetPlantBatch
      description: Get Plant Batch by ID
      operationId: GetPlantBatchById
      parameters:
      - name: plant_batch_id
        in: path
        description: Plant Batch ID
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlantBatch'
        '400':
          $ref: '#/components/responses/400BadRequest'
        '401':
          $ref: '#/components/responses/401NotAuthenticated'
        '403':
          $ref: '#/components/responses/403AccessDenied'
        '404':
          $ref: '#/components/responses/404NotFound'
        '500':
          $ref: '#/components/responses/500ServerError'
components:
  responses:
    400BadRequest:
      description: Bad request
    401NotAuthenticated:
      description: Not authenticated
    403AccessDenied:
      description: Access denied
    404NotFound:
      description: The specified resource was not found
    500ServerError:
      description: Server error
  schemas:
    PlantBatch:
      title: Plant Batch
      required:
      - id
      - name
      properties:
        id:
          type: integer
          example: 123
        name:
          type: string
          example: 1A4FF0000000022000000719
        mature_count:
          type: integer
          example: 21
        immature_count:
          type: integer
          example: 2
        vegetative_count:
          type: integer
          example: 23
        flowering_count:
          type: integer
          example: 25
        source:
          type: string
          example: Clone
        planted_date:
          type: string
          example: 2018-11-06 08:00:00+00:00
        destroyed_count:
          type: integer
          example: 5
        notes:
          type: string
          example: nice batch!
        strain:
          $ref: '#/components/schemas/Strain'
        location:
          $ref: '#/components/schemas/Location'
        lot_id:
          type: string
        updated_at:
          type: string
          example: 2018-11-06 08:00:00+00:00
    Strain:
      title: Strain
      required:
      - id
      - name
      properties:
        id:
          type: integer
        name:
          type: string
          example: Lemon Skunk
          description: Strain name
        notes:
          type: string
          example: Terpenes .63%
          description: Notes
        sku:
          type: string
          example: BIOJJ
          description: SKU
        testing_status:
          type: string
          example: InHouse
          description: 'Testing status: InHouse, ThirdParty, None, NA'
        indica_percent:
          type: number
          example: 45.0
          description: Indica Percentage
        sativa_percent:
          type: number
          example: 55.0
          description: Sativa Percentage
        cross_strains:
          type: array
          description: Cross strains
          items:
            $ref: '#/components/schemas/CrossStrain'
    ParentLocation:
      title: Parent Location
      required:
      - id
      - name
      properties:
        id:
          type: integer
          example: 123
        name:
          type: string
          example: Pro System
        sqft:
          type: number
          example: 14.4
        num_lights:
          type: integer
          example: 42
        updated_at:
          type: string
          example: 2018-11-06 08:00:00+00:00
        is_active:
          type: boolean
          example: true
    Location:
      title: Location
      required:
      - id
      - name
      properties:
        id:
          type: integer
          example: 123
        name:
          type: string
          example: Pro System
        sqft:
          type: number
          example: 14.4
        num_lights:
          type: integer
          example: 42
        parent_location:
          $ref: '#/components/schemas/ParentLocation'
        updated_at:
          type: string
          example: 2018-11-06 08:00:00+00:00
        is_active:
          type: boolean
          example: true
    CrossStrain:
      title: Cross Strain
      required:
      - id
      - name
      properties:
        id:
          type: integer
        name:
          type: string
          example: Lemon Skunk
          description: Strain name
        notes:
          type: string
          example: Terpenes .63%
          description: Notes
        sku:
          type: string
          example: BIOJJ
          description: SKU
        testing_status:
          type: string
          example: InHouse
          description: 'Testing status: InHouse, ThirdParty, None, NA'
        indica_percent:
          type: number
          example: 45.0
          description: Indica Percentage
        sativa_percent:
          type: number
          example: 55.0
          description: Sativa Percentage
  parameters:
    offsetParam:
      name: offset
      in: query
      description: Offset for the returned records (optional)
      schema:
        type: integer
        default: 0
        example: 20
    limitParam:
      name: limit
      in: query
      description: Max number of records to return (optional). Cannot exceed 2000
      required: false
      style: form
      schema:
        type: integer
        default: 2000
        example: 100
    orderByParam:
      name: order_by
      in: query
      description: Order-by clause, in SQL format (optional)
      schema:
        type: string
        example: id desc
    whereParam:
      name: where
      in: query
      description: 'Filter results using SQL-like WHERE clause syntax (optional).


        **Supported operators**: =, >, <, >=, <=, BETWEEN, IN, LIKE, AND, OR


        **Supported patterns**:

        - Equality: `status=''Active''`

        - Comparison: `updated_at >= ''2024-01-01''`

        - Range: `id BETWEEN 1 AND 10000`

        - List: `status IN (''Active'', ''Pending'')`

        - Pattern: `sku LIKE ''ABC%''`

        - Compound: `facility_id=123 AND is_active=true`

        '
      schema:
        type: string
        example: status='Active' AND updated_at >= '2024-01-01'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY