1.1 KiB
1.1 KiB
Wren API Tutorial (Node.js)
This example demonstrates how to use the Wren API to:
- Fetch available offset projects
- Create a carbon offset order
Setup
- Install dependencies:
npm install
- Create a
.envfile with your Wren API token:
WREN_API_TOKEN=your-token-here
- Run the example:
npm start
API Documentation
For full API documentation, visit: https://wren.co/api
Features
- Environment variable configuration
- Error handling
- Project listing
- Order creation
- Response parsing
Sample Output
Fetching available offset projects...
Found 3 projects:
- Direct Air Carbon Capture (Iceland)
Price: $250/ton
Type: Direct Air Capture
- Coastal Mangrove Restoration (Indonesia)
Price: $150/ton
Type: Nature-Based
- Ocean Carbon Removal (Global Oceans)
Price: $200/ton
Type: Ocean-Based
Creating offset order for 1 ton of CO2...
Order created successfully!
------------------------
Order ID: ord_123abc
Amount: $200
Status: completed
Portfolio: Standard Portfolio
Portfolio projects:
- Direct Air Carbon Capture
- Coastal Mangrove Restoration