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

# Create Farmer Endpoint

> This API endpoint allows you to seamlessly integrate and create a new submission for farmers within the supply chain system. Through this endpoint, you can capture essential information about farmers, including entity card details, form submissions, contact information, and additional demographic data.



## OpenAPI

````yaml post /supply-chains/farmers/
openapi: 3.0.1
info:
  title: Trace Connect API
  version: v1
servers:
  - url: http://localhost:3000/connect/v1
security:
  - Bearer: []
paths:
  /supply-chains/farmers/:
    post:
      tags:
        - supply-chains
      description: A viewset for viewing and editing Farmer instances.
      operationId: supply-chains_farmers_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Farmer'
        required: true
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Farmer'
components:
  schemas:
    Farmer:
      required:
        - first_name
      type: object
      properties:
        id:
          type: string
          description: >
            Unique identifier for the farmer. This identifier is used to
            distinguish one farmer from another in the system.
        entity_card:
          $ref: '#/components/schemas/EntityCard'
          description: |
            Information related to the Connect card of the farmer. 
        submission:
          $ref: '#/components/schemas/Submission'
          description: >
            Submission details related to the farmer. This could include any
            extra fields metioned in form associated with the company.
        phone:
          title: Phone
          type: string
          nullable: true
          description: >
            Phone number of the farmer. This is typically used for contacting
            the farmer if necessary.
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
          description: >
            Date and time when the farmer information was last updated. This
            field is automatically generated and cannot be modified directly.
        created_on:
          title: Created On
          type: string
          format: date-time
          description: >
            Date and time when the farmer information was created. This field
            indicates when the farmer record was initially added to the system.
        image:
          title: Photo
          type: string
          format: uri
          nullable: true
          readOnly: true
          description: >
            URL to the photo of the farmer. This could be a link to a profile
            picture or any relevant image associated with the farmer.
        description:
          title: Description
          maxLength: 500
          type: string
          nullable: true
          description: >
            Description or additional information about the farmer. This field
            allows for notes or comments to be added regarding the farmer.
        house_name:
          title: House name
          maxLength: 100
          type: string
          nullable: true
          description: >
            Name of the house or building where the farmer resides. This could
            be useful for address clarification.
        street:
          title: Street
          maxLength: 500
          type: string
          nullable: true
          description: >
            Name of the street where the farmer resides. This is part of the
            farmer's address details.
        city:
          title: City
          maxLength: 500
          type: string
          nullable: true
          description: >
            Name of the city where the farmer resides. This is part of the
            farmer's address details.
        sub_province:
          title: Sub province
          maxLength: 500
          type: string
          nullable: true
          description: >
            Name of the sub-province where the farmer resides. This is part of
            the farmer's address details.
        province:
          title: Province
          maxLength: 500
          type: string
          nullable: true
          description: >
            Name of the province where the farmer resides. This is part of the
            farmer's address details.
        latitude:
          title: Latitude
          type: number
          description: >
            Latitude coordinate of the farmer's location. This is used for
            geolocation purposes.
        longitude:
          title: Longitude
          type: number
          description: >
            Longitude coordinate of the farmer's location. This is used for
            geolocation purposes.
        zipcode:
          title: Zipcode
          maxLength: 50
          type: string
          nullable: true
          description: >
            Postal code or ZIP code of the area where the farmer resides. This
            is part of the farmer's address details.
        country:
          title: Country
          maxLength: 500
          type: string
          nullable: true
          description: >
            Name of the country where the farmer resides. This is part of the
            farmer's address details.
        number:
          title: Number
          maxLength: 10
          type: string
          nullable: true
          description: >
            Additional number for reference. It will be a auto generated value
            field.
        email:
          title: Email Address
          maxLength: 100
          type: string
          format: email
          nullable: true
          description: >
            Email address of the farmer. This is used for electronic
            communication with the farmer.
        identification_no:
          title: Identification
          maxLength: 100
          type: string
          nullable: true
          description: >
            Identification number of the farmer. This could be a national
            identification number or any other form of identification.
        reference_number:
          title: Reference Number
          maxLength: 100
          type: string
          nullable: true
          description: >
            Reference number associated with the farmer. This could be a
            reference to another system or database.
        first_name:
          title: First Name
          maxLength: 100
          minLength: 1
          type: string
          description: >
            First name of the farmer. This is part of the farmer's personal
            details.
        last_name:
          title: Last Name
          maxLength: 100
          type: string
          nullable: true
          description: >
            Last name of the farmer. This is part of the farmer's personal
            details.
        date_of_birth:
          title: Date of Birth
          type: string
          format: date
          nullable: true
          description: >
            Date of birth of the farmer. This is part of the farmer's personal
            details.
        gender:
          title: Gender
          maxLength: 50
          type: string
          nullable: true
          description: |
            Gender of the farmer. This is part of the farmer's personal details.
        consent_status:
          title: Consent Status
          type: string
          enum:
            - GRANTED
            - NOT_GRANTED
            - UNKNOWN
          description: >
            Consent status of the farmer for data usage. This indicates whether
            the farmer has given consent for their data to be used.
        creator:
          type: string
          description: >
            Identifier of the user who created the farmer entry. This indicates
            the user responsible for adding the farmer information to the
            system.
        updater:
          type: string
          description: >
            Identifier of the user who last updated the farmer entry. This
            indicates the user responsible for the latest modifications to the
            farmer information.
        buyer:
          type: string
          description: >
            Identifier of the buyer associated with the farmer. This indicates
            any buyer or customer linked to the farmer, if applicable.
    EntityCard:
      required:
        - card
        - entity
      type: object
      properties:
        id:
          type: string
        card:
          $ref: '#/components/schemas/ConnectCard'
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        is_active:
          title: Is Active
          type: boolean
          readOnly: true
        creator:
          type: string
        updater:
          type: string
        entity:
          type: string
    Submission:
      required:
        - form
        - values
      type: object
      properties:
        id:
          type: string
        form_details:
          $ref: '#/components/schemas/Form'
        values:
          type: array
          items:
            $ref: '#/components/schemas/SubmissionValues'
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        creator:
          type: string
        updater:
          type: string
        form:
          type: string
        product:
          type: string
    ConnectCard:
      required:
        - card_id
      type: object
      properties:
        id:
          type: string
        card_id:
          title: Card id
          minLength: 1
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        display_id:
          title: Display ID
          maxLength: 100
          type: string
          nullable: true
        creator:
          type: string
        updater:
          type: string
    Form:
      required:
        - fields
        - owner
      type: object
      properties:
        id:
          type: string
        products:
          type: array
          readOnly: true
          items:
            $ref: '#/components/schemas/Product'
        fields:
          type: array
          items:
            $ref: '#/components/schemas/FormField'
        field_config:
          type: array
          items:
            $ref: '#/components/schemas/FormFieldConfig'
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        form_type:
          title: Form Type
          type: string
          enum:
            - TRANSACTION
            - FARMER
            - PAYMENT
            - PRODUCT
        creator:
          type: string
        updater:
          type: string
        owner:
          type: string
    SubmissionValues:
      required:
        - field
        - value
      type: object
      properties:
        id:
          type: string
        field_details:
          $ref: '#/components/schemas/FormField'
        field:
          title: Field
          minLength: 1
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        value:
          title: Value
          maxLength: 100
          minLength: 1
          type: string
        creator:
          type: string
        updater:
          type: string
    Product:
      required:
        - name
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the product.
        premiums:
          title: Premiums
          type: string
          readOnly: true
          description: Premiums associated with the product.
        is_active:
          title: Is active
          type: string
          readOnly: true
          description: Indicates whether the product is currently active.
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
          description: Date and time when the product information was last updated.
        created_on:
          title: Created On
          type: string
          format: date-time
          readOnly: true
          description: Date and time when the product was created.
        name:
          title: Product Name
          maxLength: 500
          minLength: 1
          type: string
          description: Name of the product.
        description:
          title: Product Description
          maxLength: 500
          type: string
          nullable: true
          description: Description of the product.
        image:
          title: Product Image
          type: string
          format: uri
          nullable: true
          readOnly: true
          description: URL to the image or photo of the product.
        creator:
          type: string
          description: Identifier of the user who created the product.
        updater:
          type: string
          description: Identifier of the user who last updated the product.
    FormField:
      required:
        - label
        - type
      type: object
      properties:
        id:
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        label:
          title: Label
          maxLength: 100
          minLength: 1
          type: string
        label_en_us:
          title: Label [en-us]
          maxLength: 100
          type: string
          nullable: true
        label_en_uk:
          title: Label [en-uk]
          maxLength: 100
          type: string
          nullable: true
        label_fr:
          title: Label [fr]
          maxLength: 100
          type: string
          nullable: true
        label_nl:
          title: Label [nl]
          maxLength: 100
          type: string
          nullable: true
        label_ind:
          title: Label [ind]
          maxLength: 100
          type: string
          nullable: true
        type:
          title: Field Type
          type: string
          enum:
            - TEXT
            - INTEGER
            - FLOAT
            - RADIO
            - MULTI_SELECT
            - EMAIL
            - PHONE
            - DATE
            - BOOLEAN
            - DROPDOWN
        key:
          title: Key
          maxLength: 100
          type: string
          nullable: true
        required:
          title: Required
          type: boolean
        default_value:
          title: Default Value
          maxLength: 100
          type: string
          nullable: true
        options:
          title: Options
          type: string
          nullable: true
        creator:
          type: string
        updater:
          type: string
    FormFieldConfig:
      required:
        - key
        - label
      type: object
      properties:
        id:
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        label:
          title: Label
          maxLength: 100
          minLength: 1
          type: string
        key:
          title: Key
          maxLength: 100
          minLength: 1
          type: string
        visibility:
          title: Visibility
          type: boolean
        required:
          title: Required
          type: boolean
        creator:
          type: string
        updater:
          type: string
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header

````