🚀 API Documentation

Welcome to the Pasture Portal API documentation. This comprehensive guide will help you integrate with our species and products API. The API provides secure, RESTful access to cultivar and product data.

API Status: Production Ready • Version: v1

🔐 Authentication

All API requests require authentication using an API key. Include your API key in the X-API-KEY header for every request.

API Key Management

Your API key is unique to your partner account and should be kept confidential. Never share your API key publicly or commit it to version control systems.

Security Notice: Treat your API key like a password. If you suspect your key has been compromised, regenerate it immediately from your partner dashboard.

Header Format

HTTP Header X-API-KEY: pp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

📍 Base URL

All API endpoints are relative to the following base URL:

Production https://pastureportal.com.au/wp-json/pmapi/v1

Append endpoint paths to this base URL to construct your complete request URL.

📦 Endpoints

List Species & Products

Retrieve a list of species and associated products available to your partner account.

GET /species

Query Parameters

Parameter Type Description Example
page integer Page number for pagination (default: 1) 1
per_page integer Items per page (default: 100, max: 100) 50
species_id integer Filter by specific cultivar ID (single) 273
state_id integer Filter by specific State ID (single) 298
region_id integer Filter by specific Region ID (single) 299
rainfall_id integer Filter by specific Rainfall ID (single) 284
soiltype_id integer Filter by specific Soil type ID (single) 277
ph_id integer Filter by specific Ph ID (single) 277
drainage_id integer Filter by specific Drainage ID (single) 268
persistence_id integer Filter by specific Persistence ID (single) 269
typecat_id integer Filter by specific Typecat ID (single) 269
tropicaltemperate_id integer Filter by specific tropical temperate ID (single) 206
type_id integer Filter by specific Type ID (single) 271

Response Schema

JSON
{
    "success": true,
    "partner": {
        "id": "1759923414",
        "name": "T",
        "email": "[email protected]",
        "logo_url": "https://pastureportal.com.au/wp-content/themes/pastureportal/partner-manage-api/assets/images/1759923414/Group-35476.png",
        "status": "active",
        "term": [
            "273",
            "346"
        ]
    },
    "pagination": {
        "page": 1,
        "per_page": 100,
        "total": 3320,
        "pages": 34
    },
    "species_breakdown": [
        {
            "id": "273",
            "name": "Aztec atro",
            "count": 2240,
            "advanced_description": {
                "advantages": [
                    "✔︎ Tolerates a wide range of soil types",
                    "✔︎ Handles acidic soils",
                    "✔︎ Selected for increased leaf yield and rust tolerance"
                ],
                "disadvantages": [
                    "✘ Does not handle continuous grazing",
                    "✘ Does not tolerate water logging",
                    "✘ Requires higher fertility soils"
                ],
                "compatible": [
                    "Compatible pasture plants",
                    "Grasses: Buffel Grass, Rhodes Grass, Bambatsi Panic, Kikuyu, Panics, Setaria, Tall Finger Grass.",
                    "Legumes: Burgundy Bean, Butterfly Pea, Creeping Vigna, Glycine, Greenleaf Desmodium, Round Leaf Cassia, Shrubby Stylo, Common Stylo, Caribbean Stylo."
                ]
            }
        },
        {
            "id": "346",
            "name": "Bambatsi",
            "count": 1080,
            "advanced_description": {
                "advantages": [
                    "✔︎ Drought tolerant and hardy",
                    "✔︎ Once established is extremely persistent",
                    "✔︎ Affinity for black clay soils"
                ],
                "disadvantages": [
                    "✘ Slow to establish",
                    "✘ Livestock less likely to graze once the plant becomes overgrown",
                    "✘ Not suited to low fertility soils"
                ],
                "compatible": [
                    "Compatible pasture plants",
                    "Grasses: Buffel Grass, Rhodes Grass, Creeping Bluegrass, Forest Bluegrass, Tall Finger Grass, Digit Grass.",
                    "Legumes: Siratro, Burgundy Bean, Butterfly Pea, Caatinga Stylo, Desmanthus, Caribbean Stylo."
                ]
            }
        }
    ],
    "products": [
        {
            "id": 69486,
            "title": "Aztec atro",
            "link": "https://pastureportal.com.au/products_porture/aztec-atro-4480/",
            "state": [
                {
                    "id": 298,
                    "name": "WA"
                }
            ],
            "region": [
                {
                    "id": 299,
                    "name": "Northern Agricultural Region"
                }
            ],
            "rainfall": [
                {
                    "id": 284,
                    "name": "> 1000"
                }
            ],
            "soil_type": [
                {
                    "id": 281,
                    "name": "Clay"
                }
            ],
            "ph": [
                {
                    "id": 277,
                    "name": "Alkaline (7.5 - 8.5 pH Water)"
                }
            ],
            "drainage": [
                {
                    "id": 274,
                    "name": "Less well drained"
                }
            ],
            "persistence": [
                {
                    "id": 269,
                    "name": "Perennial"
                }
            ],
            "tropical-temperate": [
                {
                    "id": 206,
                    "name": "Tropical"
                }
            ],
            "cultivar": [
                {
                    "id": 273,
                    "name": "Aztec atro"
                }
            ],
            "type": [
                {
                    "id": 271,
                    "name": "Tropical_Legumes"
                }
            ],
            "type_cat": [
                {
                    "id": 402,
                    "name": "Siratro"
                }
            ]
        },
        {
            "id": 69484,
            "title": "Aztec atro",
            "link": "https://pastureportal.com.au/products_porture/aztec-atro-4479/",
            "state": [
                {
                    "id": 298,
                    "name": "WA"
                }
            ],
            "region": [
                {
                    "id": 299,
                    "name": "Northern Agricultural Region"
                }
            ],
            "rainfall": [
                {
                    "id": 284,
                    "name": "> 1000"
                }
            ],
            "soil_type": [
                {
                    "id": 281,
                    "name": "Clay"
                }
            ],
            "ph": [
                {
                    "id": 277,
                    "name": "Alkaline (7.5 - 8.5 pH Water)"
                }
            ],
            "drainage": [
                {
                    "id": 268,
                    "name": "Well drained"
                }
            ],
            "persistence": [
                {
                    "id": 269,
                    "name": "Perennial"
                }
            ],
            "tropical-temperate": [
                {
                    "id": 206,
                    "name": "Tropical"
                }
            ],
            "cultivar": [
                {
                    "id": 273,
                    "name": "Aztec atro"
                }
            ],
            "type": [
                {
                    "id": 271,
                    "name": "Tropical_Legumes"
                }
            ],
            "type_cat": [
                {
                    "id": 402,
                    "name": "Siratro"
                }
            ]
        },
    "timestamp": "2025-10-17 08:41:28"
}
                        

💻 Example Requests

cURL curl -X GET "https://pastureportal.com.au/wp-json/pmapi/v1/species?page=1&per_page=50" \ -H "X-API-KEY: pp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json"
PHP
<?php
$api_key = 'pp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$base_url = 'https://pastureportal.com.au/wp-json/pmapi/v1/species';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $base_url . '?page=1&per_page=50');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-API-KEY: ' . $api_key,
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code === 200) {
    $data = json_decode($response, true);
    print_r($data);
} else {
    echo "Error: HTTP $http_code";
}
?>
JavaScript
const apiKey = 'pp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const baseUrl = 'https://pastureportal.com.au/wp-json/pmapi/v1/species';

const params = new URLSearchParams({
    page: 1,
    per_page: 50,
    species_id: 273
});

fetch(`${baseUrl}?${params}`, {
    method: 'GET',
    headers: {
        'X-API-KEY': apiKey,
        'Content-Type': 'application/json'
    }
})
.then(response => {
    if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
    }
    return response.json();
})
.then(data => {
    console.log('Success:', data);
    console.log('Products:', data.products);
    console.log('Pagination:', data.pagination);
})
.catch(error => console.error('Error:', error));

📊 Status Codes

The API uses standard HTTP status codes to indicate the success or failure of requests.

Code Message Description
200 OK Request succeeded. The response will include the requested data.
400 Bad Request Invalid query parameters or malformed request syntax.
401 Unauthorized API Key is missing or invalid. Verify your X-API-KEY header.
403 Forbidden Partner account is not active or lacks required permissions.
500 Server Error Internal server error. Please retry later or contact support.

⚠️ Error Handling

The API returns error responses in JSON format with detailed error information.

Error Response Format

JSON
{
  "code": "invalid_key",
  "message": "Invalid API Key",
  "status": 403
}

Common Error Scenarios

Error Code Status Cause Solution
no_api_key 401 Missing X-API-KEY header Include the API key in request headers
invalid_key 403 API key doesn't exist or is incorrect Verify your API key from dashboard
inactive 403 Partner account is suspended/pending Contact support to activate account
not_found 404 Species ID not available for partner Use valid species IDs from your profile

🤝 Support

Need help? Contact our support team at [email protected] or visit your partner dashboard for additional resources.