API Documentation
Complete API specifications, testing tools, and integration guides for The Villa Life (TVL) Platform.
Quick Start
- OpenAPI Spec: openapi.yaml- Complete REST API specification
- Postman Collection: postman-collection.json- Ready-to-import API tests
- Environments: postman-environments/- Local, staging, production configs
Files
API Specifications
- OpenAPI 3.0 specification
- All REST endpoints documented
- Request/response schemas
- Authentication requirements
- Error codes and responses
- Can be imported into Postman, Swagger UI, or any OpenAPI-compatible tool
Postman Collection
- Complete API test suite
- Pre-request scripts for authentication
- Environment variable usage
- Example requests for all endpoints
- Response validation tests
Postman Environments:
- postman-env-local.json- Local development (localhost:3000)
- postman-env-staging.json- Staging environment
- postman-env-production.json- Production environment
Guides
Practical guides for API development, testing, and integration.
API Testing Guide
- Setting up Postman
- Running automated tests
- CI/CD integration
- Load testing with k6
Contract Testing
- Consumer-driven contract testing
- Pact integration
- Schema validation
- Backward compatibility
Postman Guide
- Importing collections
- Using environments
- Writing tests
- Debugging requests
SDK Generation Guide
- Generating TypeScript SDK
- Generating Python SDK
- Custom SDK templates
- Versioning strategy
API Changelog
- Breaking changes
- Deprecations
- New endpoints
- Version history
API Versioning
TVL Platform APIs follow semantic versioning:
- Base URL: https://api.thevillalife.com/v1
- Current Version: v1
- Versioning Strategy: URL-based (/v1/,/v2/)
Authentication
All API endpoints require authentication via:
- OAuth 2.0 with Google OIDC
- Bearer tokens in Authorizationheader
- API keys for service-to-service communication
See OpenAPI spec for detailed authentication requirements per endpoint.
Rate Limiting
- Default: 100 requests/minute per user
- Burst: 10 requests/second
- Headers:
- X-RateLimit-Limit- Total limit
- X-RateLimit-Remaining- Remaining requests
- X-RateLimit-Reset- Reset time (Unix timestamp)
 
Error Handling
TVL APIs use RFC 7807 Problem Details format:
{
  "type": "https://api.thevillalife.com/errors/validation-error",
  "title": "Validation Error",
  "status": 400,
  "detail": "Invalid email format",
  "instance": "/api/v1/users/123",
  "errors": [
    {
      "field": "email",
      "message": "Must be a valid email address",
      "code": "INVALID_FORMAT"
    }
  ]
}
Testing
Local Testing
# Import Postman collection and local environment
# Set base_url variable to http://localhost:3000
# Run collection tests
Automated Testing
# Using Newman (Postman CLI)
newman run postman-collection.json \
  -e postman-environments/postman-env-local.json \
  --reporters cli,json
# Using k6 for load testing
k6 run load-tests/api-load-test.js
SDK Generation
Generate client SDKs from OpenAPI spec:
# TypeScript
./scripts/generate-typescript-sdk.sh
# Python
./scripts/generate-python-sdk.sh
See: SDK Generation Guide
Related Documentation
- Domain Specs: /prd/domains/ - Business logic for each domain
- Implementation Guides: /docs/implementation-guides/ - Detailed how-to guides
- Database Schemas: /prd/migrations/ - SQL migration scripts
- Architecture: /docs/architecture/ - System design
Contributing
When adding new endpoints:
- Update openapi.yamlwith complete specification
- Add examples to Postman collection
- Write integration tests
- Update API changelog
- Regenerate SDKs if client-facing
Last Updated: 2025-10-25