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

# Purchase a policy

> Creates a PENDING policy awaiting premium. Requires the organization to be KYB-verified and the farmer's KYC to be APPROVED.



## OpenAPI

````yaml /api-reference/openapi.json post /policies/purchase
openapi: 3.1.0
info:
  title: MicroCrop Partner API
  version: 1.0.0
  description: >-
    Parametric crop & livestock insurance API for integrating partners. All
    requests authenticate with an organization API key in the `x-api-key`
    header.
servers:
  - url: https://app.microcrop.app/api
    description: Production (Base mainnet)
security:
  - apiKey: []
tags:
  - name: Farmers
  - name: Plots
  - name: Herds
  - name: Policies
  - name: Payments
  - name: Payouts
  - name: Organization
  - name: Determinations
paths:
  /policies/purchase:
    post:
      tags:
        - Policies
      summary: Purchase a policy
      description: >-
        Creates a PENDING policy awaiting premium. Requires the organization to
        be KYB-verified and the farmer's KYC to be APPROVED.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PolicyInput'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurchaseEnvelope'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    PolicyInput:
      type: object
      required:
        - farmerId
      description: >-
        For CROP: plotId, sumInsured, coverageType, durationDays are required.
        For LIVESTOCK: herdId and season are required (sumInsured
        auto-calculated).
      properties:
        farmerId:
          type: string
          format: uuid
        productType:
          type: string
          enum:
            - CROP
            - LIVESTOCK
          default: CROP
        plotId:
          type: string
          format: uuid
        herdId:
          type: string
          format: uuid
        season:
          type: string
          enum:
            - LRLD
            - SRSD
        sumInsured:
          type: number
          minimum: 1000
        coverageType:
          type: string
          enum:
            - DROUGHT
            - FLOOD
            - BOTH
            - COMPREHENSIVE
            - LIVESTOCK_DROUGHT
            - LIVESTOCK_DISEASE
            - LIVESTOCK_COMPREHENSIVE
        durationDays:
          type: integer
          minimum: 30
          maximum: 365
    PurchaseEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            policy:
              $ref: '#/components/schemas/Policy'
            paymentInstructions:
              type: object
              properties:
                amount:
                  type: number
                policyNumber:
                  type: string
                message:
                  type: string
    Policy:
      type: object
      properties:
        id:
          type: string
          format: uuid
        policyNumber:
          type: string
        status:
          type: string
          enum:
            - PENDING
            - ACTIVE
            - EXPIRED
            - CANCELLED
        premiumPaid:
          type: boolean
        sumInsured:
          type: number
        premium:
          type: number
        coverageType:
          type: string
        onChainPolicyId:
          type: string
          nullable: true
        daysRemaining:
          type: integer
        payouts:
          type: array
          items:
            type: object
        damageAssessments:
          type: array
          items:
            type: object
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
              example: INVALID_INPUT
            message:
              type: string
            details: {}
  responses:
    BadRequest:
      description: Validation or business-rule error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: KYB verification required, or organization deactivated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````