Skip to main content
This page describes planned API endpoints for the Syngenta Warehouse Management System. The application is currently in early development. No API endpoints are currently implemented.

Introduction

The Syngenta Warehouse Management System (WMS) will provide a comprehensive REST API for managing inventory, orders, shipments, and reporting. The API will be built on Next.js App Router and will follow RESTful conventions.

Base URL

All API requests should be made to:
https://api.syngenta-wms.com/api
For development and testing:
http://localhost:3000/api

API Architecture

The API is built using Next.js 14+ App Router with the following structure:
  • Route Handlers: Located in app/api/ directory
  • API Routes: RESTful endpoints following /api/v1/{resource} pattern
  • Data Layer: Prisma ORM with PostgreSQL database
  • Authentication: JWT-based authentication with secure token management
  • Rate Limiting: Implemented per endpoint to ensure fair usage

Request Format

All requests should include the following headers:
Content-Type: application/json
Authorization: Bearer {your_access_token}

Request Example

curl -X GET https://api.syngenta-wms.com/api/v1/inventory \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json"

Response Format

All API responses follow a consistent JSON structure:

Success Response

{
  "success": true,
  "data": {
    // Response data object or array
  },
  "metadata": {
    "timestamp": "2026-03-12T10:30:00Z",
    "requestId": "req_abc123"
  }
}

Paginated Response

{
  "success": true,
  "data": [
    // Array of items
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "totalPages": 8
  },
  "metadata": {
    "timestamp": "2026-03-12T10:30:00Z",
    "requestId": "req_abc123"
  }
}

Error Response

{
  "success": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "The request parameters are invalid",
    "details": [
      {
        "field": "quantity",
        "message": "Must be a positive integer"
      }
    ]
  },
  "metadata": {
    "timestamp": "2026-03-12T10:30:00Z",
    "requestId": "req_abc123"
  }
}

HTTP Status Codes

The API uses standard HTTP status codes:
Status CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
204No Content - Request successful with no response body
400Bad Request - Invalid request parameters
401Unauthorized - Invalid or missing authentication
403Forbidden - Insufficient permissions
404Not Found - Resource not found
409Conflict - Resource conflict (e.g., duplicate)
422Unprocessable Entity - Validation error
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server error
503Service Unavailable - Service temporarily unavailable

Error Codes

Common error codes returned by the API:
Error CodeDescription
INVALID_REQUESTRequest parameters are invalid
UNAUTHORIZEDAuthentication credentials are missing or invalid
FORBIDDENUser lacks required permissions
NOT_FOUNDRequested resource does not exist
DUPLICATE_RESOURCEResource already exists
VALIDATION_ERRORRequest data failed validation
INSUFFICIENT_STOCKNot enough inventory for operation
RATE_LIMIT_EXCEEDEDToo many requests
INTERNAL_ERRORInternal server error

Rate Limiting

API requests are rate-limited to ensure fair usage and system stability.
Rate limits are applied per API key:
  • Standard tier: 1,000 requests per hour
  • Premium tier: 5,000 requests per hour
  • Enterprise tier: Custom limits
Rate limit information is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1678636800

Pagination

Endpoints that return lists support pagination using query parameters:
page
integer
default:"1"
Page number to retrieve
limit
integer
default:"20"
Number of items per page (max: 100)
sort
string
Field to sort by (prefix with - for descending order)

Example

GET /api/v1/inventory?page=2&limit=50&sort=-createdAt

Filtering

Many endpoints support filtering using query parameters:
GET /api/v1/inventory?status=active&warehouse=WH001&category=seeds

Versioning

The current API version is v1. All endpoints are prefixed with /api/v1/.
API versioning ensures backward compatibility. When breaking changes are introduced, a new version will be released. Previous versions will be supported for at least 12 months after deprecation notice.

API Resources

The API provides access to the following resources:

SDKs and Libraries

Official SDKs are available for:
  • JavaScript/TypeScript (Node.js and Browser)
  • Python
  • Java
  • C#/.NET
Contact your account manager for SDK documentation and installation instructions.

Support

For API support and questions:

Build docs developers (and LLMs) love