Soil Analysis API

This section contains all the endpoints related to soil analysis, including soil testing, recommendations, and fertility management.

GET /v1/soil/analysis
Rate Limit: 500/min Cost: ₦0.0200

Get Soil Analysis

Get soil analysis data for a specific location.

Example API Call

curl -X GET "https://api.riwe.io/v1/soil/analysis" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "cec": 15.5,
    "texture": {
        "clay": 25,
        "sand": 35,
        "silt": 40
    },
    "location": {
        "name": "Abuja, Nigeria",
        "latitude": 9.0765,
        "longitude": 7.3986
    },
    "soil_type": "Clay loam",
    "properties": {
        "ph": 6.5,
        "iron": 15,
        "zinc": 2.5,
        "boron": 0.8,
        "copper": 1.2,
        "sulfur": 12,
        "calcium": 1200,
        "nitrogen": 0.15,
        "magnesium": 150,
        "manganese": 8,
        "potassium": 180,
        "phosphorus": 25,
        "organic_matter": 2.8
    },
    "analysis_date": "2023-07-15",
    "base_saturation": 75,
    "recommendations": {
        "lime_application": 0,
        "nitrogen_fertilizer": 120,
        "potassium_fertilizer": 40,
        "phosphorus_fertilizer": 60
    }
}
GET /v1/soil/recommendations
Rate Limit: 300/min Cost: ₦0.0300

Get Soil Recommendations

Get crop and fertilizer recommendations based on soil analysis.

Example API Call

curl -X GET "https://api.riwe.io/v1/soil/recommendations" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "farm_id": 1,
    "farm_name": "Main Farm",
    "soil_type": "Clay loam",
    "analysis_date": "2023-07-15",
    "crop_recommendations": [
        {
            "name": "Maize",
            "notes": "Well-suited for this soil type with proper fertilization",
            "crop_id": 1,
            "suitability_score": 85
        },
        {
            "name": "Cassava",
            "notes": "Excellent match for the soil conditions",
            "crop_id": 5,
            "suitability_score": 90
        },
        {
            "name": "Soybean",
            "notes": "Consider liming to raise pH for optimal growth",
            "crop_id": 8,
            "suitability_score": 75
        }
    ],
    "fertilizer_recommendations": {
        "npk": {
            "notes": "Apply in bands 5cm to the side and 5cm below the seed",
            "amount": 300,
            "formula": "15-15-15",
            "application_timing": "At planting"
        },
        "lime": {
            "notes": "Apply and incorporate into soil 2-3 weeks before planting",
            "amount": 500,
            "application_timing": "Before planting"
        },
        "urea": {
            "notes": "Side-dress when plants are knee-high",
            "amount": 150,
            "application_timing": "4-6 weeks after planting"
        }
    }
}
POST /v1/soil/samples
Rate Limit: 100/min Cost: ₦0.0500

Submit Soil Sample

Submit a soil sample for analysis.

Example API Call

curl -X POST "https://api.riwe.io/v1/soil/samples" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "id": 123,
    "depth": 30,
    "notes": "Sample collected from the north-east corner of the farm",
    "status": "submitted",
    "farm_id": 1,
    "location": {
        "latitude": 9.0765,
        "longitude": 7.3986
    },
    "created_at": "2023-07-15T10:30:00Z",
    "updated_at": "2023-07-15T10:30:00Z",
    "tracking_code": "SOIL-2023-07-15-123",
    "collection_date": "2023-07-15",
    "estimated_completion_date": "2023-07-22"
}