Skip to main content

Resources

Additional resources, concepts, and reference materials to help you get the most out of the Weir AI API v1.0.1.

Quick Reference

API Categories

External APIs

Purpose: Public-facing APIs for third-party integrationsAuthentication: Basic Authentication with client credentials Rate Limits: 100 requests/minute per client Use Cases: Third-party integrations, public API accessKey Endpoints:
  • POST /auth/token - Generate access token
Purpose: Organization management and internal operationsAuthentication: Bearer Token with x-source header Rate Limits: 200 requests/minute per user Use Cases: Internal management tools, organization administrationKey Endpoints:
  • POST /auth/login - User login
  • POST /org/create/team - Create team
  • GET /org/teams - Get teams
  • POST /org/create/platform - Create platform
Purpose: Platform administration and system managementAuthentication: Bearer Token with admin privileges Rate Limits: 500 requests/minute per admin Use Cases: System administration, platform monitoringKey Endpoints:
  • POST /auth/authenticateAdmin - Admin authentication
  • GET /admin/organizations - Get organizations
  • POST /pax/pod - Create pod
  • GET /logs/all - Get logs

Common Response Format

{
  "data": {
    // Response data object
  },
  "message": "Human-readable message",
  "status": "success"
}

Error Response Format

{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": "Additional error details"
  },
  "status": "error"
}

HTTP Status Codes

Success Codes

  • 200 OK: Successful GET, PUT, PATCH requests
  • 201 Created: Successful POST requests
  • 204 No Content: Successful DELETE requests

Error Codes

  • 400 Bad Request: Invalid request parameters
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Resource not found
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Server error

Rate Limiting

All APIs implement rate limiting with the following headers:
X-RateLimit-Limit
string
Maximum number of requests allowed per time window.
X-RateLimit-Remaining
string
Number of requests remaining in the current time window.
X-RateLimit-Reset
string
Unix timestamp when the rate limit window resets.

Authentication Methods

Used by: External APIs
curl -X POST 'https://api.weir.ai/auth/token' \
  -H 'Authorization: Basic base64(client_id:secret_key)'
Used by: Console APIs, Admin APIs
curl -X GET 'https://api.weir.ai/org/teams' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'x-source: console'

Pagination

Many endpoints support pagination for large datasets:
page
integer
default:"1"
Page number for pagination. Must be a positive integer.
limit
integer
default:"10"
Number of items per page. Range: 1-100.

Pagination Response Format

{
  "data": {
    "items": [...],
    "pagination": {
      "page": 1,
      "limit": 10,
      "total": 100,
      "totalPages": 10
    }
  }
}

Common Error Codes

  • UNAUTHORIZED: Invalid or expired authentication token
  • INVALID_CREDENTIALS: Invalid client credentials or user credentials
  • TOKEN_EXPIRED: Access token has expired
  • FORBIDDEN: Valid authentication but insufficient permissions
  • ACCESS_DENIED: Access denied to requested resource
  • INSUFFICIENT_PERMISSIONS: User lacks required permissions
  • VALIDATION_ERROR: Invalid request parameters
  • MISSING_REQUIRED_FIELD: Required field is missing
  • INVALID_FORMAT: Invalid data format
  • NOT_FOUND: Requested resource not found
  • RESOURCE_EXISTS: Resource already exists
  • RESOURCE_CONFLICT: Resource conflict
  • RATE_LIMIT_EXCEEDED: Too many requests in time window
  • QUOTA_EXCEEDED: API quota exceeded

Best Practices

  • Store credentials securely in environment variables
  • Implement automatic token refresh before expiration
  • Handle authentication errors gracefully
  • Use different credentials for different environments
  • Never expose tokens in client-side code
  • Implement comprehensive error handling for all API operations
  • Provide clear error messages to users
  • Log errors for debugging without exposing sensitive information
  • Handle network failures and timeouts gracefully
  • Implement retry logic with exponential backoff
  • Cache responses when possible to reduce API calls
  • Use pagination for large datasets
  • Monitor rate limit headers to avoid hitting limits
  • Implement request queuing for high-volume applications
  • Use appropriate HTTP methods for different operations
  • Always use HTTPS for all API requests
  • Validate and sanitize all input parameters
  • Implement proper CORS policies for web applications
  • Follow OWASP security guidelines
  • Use secure storage for authentication tokens

Development Workflow

Environment Setup

Set up development, staging, and production environments with appropriate API credentials.

API Testing

Use the API playground and testing tools to verify endpoint functionality.

Integration Development

Develop your integration following best practices and error handling patterns.

Testing and Validation

Test your integration thoroughly with various scenarios and edge cases.

Deployment and Monitoring

Deploy to production and monitor API usage, performance, and errors.

Support and Community

Versioning and Compatibility

API Versioning

The Weir AI API uses URL-based versioning:
  • Current Version: v1.0.1
  • Version Format: /v{major}.{minor}.{patch}
  • Backward Compatibility: Minor and patch versions maintain backward compatibility
  • Breaking Changes: Only major version changes introduce breaking changes

Migration Guidelines

  • Review changelog for new features and changes
  • Test new endpoints in staging environment
  • Update client code to handle new response formats
  • Monitor for deprecated endpoints and plan migration
  • Major version updates may introduce breaking changes
  • Review migration guides for detailed instructions
  • Plan migration timeline and testing strategy
  • Update documentation and client code accordingly
Pro Tip: Bookmark this resources page for quick reference. The core concepts guide provides essential background knowledge, while the changelog keeps you updated on new features and changes.