API Quickstart
Get started with the AGIN Cloud GraphQL API in under 5 minutes
Get Your API Key
Before making your first GraphQL query, you'll need an API key from the AGIN Cloud console.
Generate Your API Key
- Log in to the AGIN Cloud Console
- Navigate to Settings > API Keys
- Click Generate New Key
- Copy and securely store your API key
Important
Your API key will only be shown once. Store it securely and never commit it to version control.
GraphQL Endpoint
All GraphQL requests should be made to:
https://api-preview.agin.africa/graphqlMake Your First Query
Let's verify your API key by fetching your account information.
curl -X POST https://api.agin.cloud/graphql \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "query { account { id name email plan } }"
}'Response
{
"data": {
"account": {
"id": "acc_1234567890",
"name": "Green Valley Farms",
"email": "admin@greenvalley.com",
"plan": "PROFESSIONAL"
}
}
}Interactive Playground
Explore the API interactively using our GraphQL Playground:
The playground provides:
- Interactive query builder with auto-complete
- Real-time schema documentation
- Query validation and testing
- No setup required - just add your API key
Example Queries
List Your Farms
query {
farms(first: 10) {
edges {
node {
id
name
location
totalArea
}
}
}
}Get Farm Details
query GetFarm($farmId: ID!) {
farm(id: $farmId) {
id
name
location
fields {
id
name
size
cropType
}
}
}Variables:
{
"farmId": "farm_abc123"
}Recent Harvests
query {
harvests(first: 10, orderBy: { harvestDate: DESC }) {
id
cropType
quantity
unit
harvestDate
}
}Create Your First Record
Here's a simple mutation to create a harvest record:
mutation CreateHarvest($input: CreateHarvestInput!) {
createHarvest(input: $input) {
harvest {
id
cropType
quantity
harvestDate
}
}
}Variables:
{
"input": {
"operationId": "op_abc123",
"cropType": "MAIZE",
"quantity": 5000,
"unit": "KG",
"harvestDate": "2024-10-15"
}
}Rate Limits
| Plan | Requests per minute | Requests per day |
|---|---|---|
| Free | 60 | 1,000 |
| Professional | 600 | 50,000 |
| Enterprise | Unlimited | Unlimited |
Error Handling
Errors are returned in a standardized format:
{
"errors": [
{
"message": "The cropType field is required",
"extensions": {
"code": "VALIDATION_ERROR"
}
}
]
}Common Error Codes
UNAUTHENTICATED- Invalid or missing API keyFORBIDDEN- Insufficient permissionsVALIDATION_ERROR- Input validation failedNOT_FOUND- Resource does not existRATE_LIMITED- Rate limit exceeded
Next Steps
GraphQL Schema
Explore the complete GraphQL schema and type definitions
Authentication
Learn about API keys, tokens, and security best practices
Core Resources
Explore farms, operations, harvests, and inventory endpoints
SDKs
Use our official GraphQL clients for Node.js, Python, and more
Need Help?
- GraphQL Playground - Interactive API explorer
- Full API Reference - Complete documentation
- Community Forum - Ask questions
- Support - Contact our team