Bulk Upload Purchases
Bulk Upload Purchases
Get a presigned URL to upload multiple purchases via CSV
POST
Bulk Upload Purchases
Bulk Upload Purchases
Upload hundreds of purchases at once via a CSV file. This endpoint returns a presigned S3 URL so you can upload your file, which will be processed asynchronously.This method is recommended for bulk uploads. Purchases are persisted in the database and emissions are calculated automatically based on economic input-output factors.
Upload Flow
Asynchronous processing
The system processes your file in the background, creating purchases and calculating emissions
Verify results
Check your purchases with the List Purchases endpoint
Step 1: Request Presigned URL
Request
Headers
Your API key for authenticationExample:
sk_live_1234567890abcdefYour organization UUIDExample:
ff4adcc7-8172-45fe-9cf1-e90a6de53aa9Your user UUIDExample:
a1b2c3d4-e5f6-7890-abcd-ef1234567890Body Parameters
Name of the CSV file you’re going to uploadExample:
"2024_q1_purchases.csv"MIME type of the file (defaults to CSV)Example:
"text/csv"Response
Presigned S3 URL to upload the purchases file
Sanitized file name (alphanumeric only)
File UUID for tracking
Full S3 key where file will be stored
Confirmation message
Example
Successful Response
Step 2: Upload CSV to S3
Use the presigned URL to upload your CSV file directly to S3:CSV Format
The CSV must follow this structure for creating purchases:Required Columns
| Column | Description | Valid Values | Example |
|---|---|---|---|
quantity | Purchase amount | Positive number | 25000.50 |
unit_id | UUID of currency unit | UUID from /api/v1/units?type=fiat_currency | eur-unit-uuid |
sector | Economic sector | Sector name from EXIOBASE | "IT Services" |
product_name | Product or service name | Free text | "Cloud Computing" |
purchase_date | Date of purchase | YYYY-MM-DD format | 2024-01-15 |
country | Country of purchase | ISO 3166-1 alpha-2 code | ES |
Optional Columns
| Column | Description | Example |
|---|---|---|
description | Purchase description or notes | "Q1 AWS infrastructure" |
recycled | Recycled content percentage (0.0 to 1.0) | 0.3 (30% recycled) |
frequency | Purchase frequency | once, weekly, monthly, quarterly, yearly |
supplier_business_name | Supplier company name | "AWS EMEA SARL" |
supplier_country | Supplier country | ES, US, etc. |
Column Details
quantity:- Must be positive number
- Typically in currency units (EUR, USD, etc.)
- No negative values allowed
- Must be a valid UUID from the Units endpoint
- For spend-based purchases, use currency units (EUR, USD, GBP, etc.)
- Get valid unit IDs:
GET /api/v1/units?type=fiat_currency
- Economic sector classification
- Based on EXIOBASE or NAICS codes
- Examples:
"IT Services","Manufacturing","Transportation","Construction"
- Descriptive name of the product or service
- Free text field
- Examples:
"Cloud Computing","Office Furniture","Legal Services"
- Must be today or in the past
- Format:
YYYY-MM-DD - Used to select appropriate emission factors by year
- ISO 3166-1 alpha-2 country code (2 letters)
- Where the purchase was made
- Common values:
ES(Spain),US(USA),FR(France),DE(Germany),GB(UK)
- For recurring purchases
- Values:
once,weekly,monthly,quarterly,yearly - Default:
once
- Percentage of recycled content
- Range:
0.0(0%) to1.0(100%) - Reduces emission calculations
- Leave empty or
0.0if not applicable
Download Template
Download CSV Template
Template with correct format and sample data
Step 3: Asynchronous Processing
Once the CSV is uploaded:- Validation: The system validates format, units, sectors, and dates
- Processing: Each row is processed and purchases are created
- Emission Calculation: CO2e values calculated using economic input-output factors
- Supplier Matching: Suppliers are matched or created based on business_name and country
- Notification: (Coming soon) You’ll receive a webhook when complete
Processing can take from a few seconds to several minutes depending on file size and number of rows.
Step 4: Verify Results
After processing, you can query your purchases:Complete Example Script
Common Errors
400 Bad Request - Missing file_name
file_name parameter in the request body.
403 Forbidden - URL Expired
Cause: The presigned URL expired (15 minutes) Solution: Request a new presigned URL and upload the file immediately.422 Validation Error - CSV Format
Cause: The CSV has incorrect format or missing required columns Solution: Verify that your CSV has all required columns and correct format.422 Validation Error - Invalid Unit ID
Cause:unit_id doesn’t exist or is not a currency unit
Solution: Use the Units endpoint to get valid currency unit IDs, or use EUR/USD/GBP units.
422 Validation Error - Invalid Date
Cause:purchase_date is in the future
Solution: Ensure all purchase dates are today or in the past.
422 Validation Error - Invalid Country
Cause: Country code is not ISO 3166-1 alpha-2 format Solution: Use valid 2-letter country codes (ES, US, FR, DE, GB, etc.).Limits and Recommendations
| Limit | Value |
|---|---|
| Maximum file size | 100 MB |
| Maximum rows per CSV | 50,000 |
| URL expiration time | 15 minutes |
| Processing time | ~1 second per 100 purchases |
Best Practices
Data Preparation
- Clean supplier names: Use consistent naming (e.g., “AWS EMEA SARL” not “Amazon Web Services” or “AWS”)
- Validate unit IDs: Check that unit_id exists before upload using
/api/v1/units?type=fiat_currency - Standardize sectors: Use consistent sector names across purchases
- Include recycled content: For products with recycled materials, include the percentage
Error Handling
After upload, check for purchases withstatus: "error":
Incremental Updates
To update existing purchases or add new ones:- Export current purchases
- Modify or add rows
- Re-upload (system will handle duplicates)
Economic Sectors
Common sectors for spend-based emission calculations:Manufacturing & Production
Manufacturing- General manufacturingFood & Beverage ManufacturingTextile ManufacturingChemical Manufacturing
Services
IT Services- Technology and software servicesProfessional Services- Consulting, legal, accountingFinancial Services- Banking, insuranceHealthcare Services- Medical services
Transportation & Logistics
Transportation- General transport servicesAir Transport- Air freight and passengerWater Transport- Sea and inland water transportLand Transport- Road and rail transport
Construction & Real Estate
Construction- Building and infrastructureReal Estate- Property services
Other
Office Supplies- Stationery, equipmentUtilities- Water, waste managementAgriculture- Agricultural products
Emission factors vary significantly by sector. Using the correct sector classification is critical for accurate carbon accounting.
Special Notes
Spend-Based Method
Purchases uploaded via CSV use the spend-based method:- Emissions calculated based on economic input-output tables
- Formula:
CO2e = Amount (EUR) × Emission Factor (kg CO2e/EUR) - Emission factors vary by sector, product, and country/region
- Factors updated annually based on latest data
Recycled Content
Whenrecycled percentage is provided:
- Emission factor is reduced proportionally
- Example: 30% recycled content → 30% lower emissions
- Based on lifecycle assessment data
- Applies to materials like paper, plastics, metals
Supplier Matching
The system automatically:- Creates new suppliers if not found
- Matches by business_name and country
- Stores supplier data for future purchases
- Links purchases to supplier records
Country Codes
Use ISO 3166-1 alpha-2 country codes:- Spain:
ES - United States:
US - France:
FR - Germany:
DE - United Kingdom:
GB - Italy:
IT - Netherlands:
NL
Related Endpoints
List Purchases
View uploaded purchases
List Units
Get currency units for purchases
List Facilities
View your facilities
Authentication
Learn about API authentication

