emissions-api-sdk 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -2
- package/dist/Constants.js +7 -1
- package/dist/api/AuditExport.js +73 -0
- package/dist/api/AuditLog.js +99 -0
- package/dist/api/EconomicActivity.js +69 -0
- package/dist/api/Factor.js +16 -0
- package/dist/api/PhysicalActivity.js +87 -0
- package/dist/api/RealEstate.js +25 -1
- package/dist/api/TypeRecommender.js +19 -2
- package/dist/coverage/clover.xml +172 -89
- package/dist/coverage/coverage-final.json +15 -8
- package/dist/coverage/lcov-report/index.html +21 -21
- package/dist/coverage/lcov-report/src/Client.ts.html +32 -32
- package/dist/coverage/lcov-report/src/Constants.ts.html +45 -27
- package/dist/coverage/lcov-report/src/api/AuditExport.ts.html +355 -0
- package/dist/coverage/lcov-report/src/api/AuditLog.ts.html +388 -0
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +212 -5
- package/dist/coverage/lcov-report/src/api/Factor.ts.html +54 -3
- package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Location.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Metadata.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Mobile.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/PhysicalActivity.ts.html +361 -0
- package/dist/coverage/lcov-report/src/api/RealEstate.ts.html +78 -6
- package/dist/coverage/lcov-report/src/api/Stationary.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/TypeRecommender.ts.html +55 -4
- package/dist/coverage/lcov-report/src/api/Usage.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/index.html +51 -6
- package/dist/coverage/lcov-report/src/index.html +7 -7
- package/dist/coverage/lcov-report/src/request.ts.html +8 -5
- package/dist/coverage/lcov-report/src/utils.ts.html +6 -6
- package/dist/coverage/lcov-report/test/index.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/AttributionRequest.ts.html +151 -0
- package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/EconomicActivityAttributionRequest.ts.html +148 -0
- package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/PhysicalActivityEVICRequest.ts.html +148 -0
- package/dist/coverage/lcov-report/test/mocks/PhysicalActivityRequest.ts.html +151 -0
- package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/index.html +63 -3
- package/dist/coverage/lcov-report/test/testUtils.ts.html +1 -1
- package/dist/coverage/lcov.info +284 -124
- package/dist/index.js +4 -1
- package/dist/interfaces/response/AuditExportResponse.js +2 -0
- package/dist/interfaces/response/AuditLogResponse.js +2 -0
- package/dist/request.js +1 -0
- package/dist/types/Constants.d.ts +6 -0
- package/dist/types/api/AuditExport.d.ts +42 -0
- package/dist/types/api/AuditLog.d.ts +37 -0
- package/dist/types/api/EconomicActivity.d.ts +69 -0
- package/dist/types/api/Factor.d.ts +16 -0
- package/dist/types/api/PhysicalActivity.d.ts +76 -0
- package/dist/types/api/RealEstate.d.ts +25 -1
- package/dist/types/api/TypeRecommender.d.ts +19 -2
- package/dist/types/index.d.ts +6 -0
- package/dist/types/interfaces/Api.d.ts +17 -1
- package/dist/types/interfaces/Config.d.ts +5 -1
- package/dist/types/interfaces/common.d.ts +40 -0
- package/dist/types/interfaces/response/AuditExportResponse.d.ts +66 -0
- package/dist/types/interfaces/response/AuditLogResponse.d.ts +40 -0
- package/dist/types/interfaces/response/TypeRecommenderResponse.d.ts +2 -0
- package/docs/_sources/authentication.rst.txt +26 -4
- package/docs/_sources/getting_started.rst.txt +762 -74
- package/docs/_sources/index.rst.txt +13 -0
- package/docs/_sources/reference.rst.txt +48 -0
- package/docs/_sources/troubleshooting.rst.txt +77 -12
- package/docs/_static/basic.css +8 -0
- package/docs/_static/doctools.js +5 -6
- package/docs/_static/language_data.js +186 -7
- package/docs/_static/pygments.css +146 -164
- package/docs/_static/searchtools.js +60 -121
- package/docs/_static/sphinx_highlight.js +31 -36
- package/docs/_static/styles/furo.css +1 -1
- package/docs/_static/styles/furo.css.map +1 -1
- package/docs/authentication.html +61 -26
- package/docs/client.html +33 -22
- package/docs/genindex.html +77 -24
- package/docs/getting_started.html +969 -103
- package/docs/index.html +69 -21
- package/docs/reference.html +747 -66
- package/docs/sdk.html +32 -21
- package/docs/search.html +32 -21
- package/docs/searchindex.js +1 -1
- package/docs/troubleshooting.html +105 -38
- package/package.json +8 -3
- package/sphinx-build/source/authentication.rst +26 -4
- package/sphinx-build/source/getting_started.rst +762 -74
- package/sphinx-build/source/index.rst +13 -0
- package/sphinx-build/source/reference.rst +48 -0
- package/sphinx-build/source/troubleshooting.rst +77 -12
- package/src/Constants.ts +6 -0
- package/src/api/AuditExport.ts +90 -0
- package/src/api/AuditLog.ts +102 -0
- package/src/api/EconomicActivity.ts +69 -0
- package/src/api/Factor.ts +17 -1
- package/src/api/PhysicalActivity.ts +92 -0
- package/src/api/RealEstate.ts +25 -1
- package/src/api/TypeRecommender.ts +19 -2
- package/src/index.ts +15 -1
- package/src/interfaces/Api.ts +22 -6
- package/src/interfaces/Config.ts +6 -1
- package/src/interfaces/common.ts +46 -0
- package/src/interfaces/response/AuditExportResponse.ts +88 -0
- package/src/interfaces/response/AuditLogResponse.ts +47 -0
- package/src/interfaces/response/TypeRecommenderResponse.ts +3 -0
- package/src/request.ts +1 -0
- package/test/apiTest.test.ts +59 -3
- package/test/auditExport.test.ts +68 -0
- package/test/auditLog.test.ts +216 -0
- package/test/mocks/AttributionRequest.ts +23 -0
- package/test/mocks/EconomicActivityAttributionRequest.ts +22 -0
- package/test/mocks/PhysicalActivityEVICRequest.ts +22 -0
- package/test/mocks/PhysicalActivityRequest.ts +23 -0
- package/docs/_static/base-stemmer.js +0 -476
- package/docs/_static/english-stemmer.js +0 -1066
|
@@ -9,8 +9,9 @@ Before using the SDK, ensure you have:
|
|
|
9
9
|
|
|
10
10
|
- **Node.js** installed
|
|
11
11
|
- Active internet connection
|
|
12
|
-
- Sign up
|
|
13
|
-
-
|
|
12
|
+
- An IBMid account. Sign up at the `IBMid sign up <https://www.ibm.com/account/reg/us-en/signup?formid=urx-54311>`_ page.
|
|
13
|
+
- Access to the Emissions API service and the required credentials
|
|
14
|
+
- Read the `Introduction <https://developer.ibm.com/apis/catalog/ghgemissions--ibm-envizi-emissions-api/Introduction>`_ page for an overview of the Emissions API
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
Installation
|
|
@@ -49,101 +50,78 @@ After installation, you can import the SDK in your project:
|
|
|
49
50
|
Authentication
|
|
50
51
|
--------------
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
The SDK supports three authentication methods:
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
- **Personal Access Token (PAT)**, recommended for most users
|
|
56
|
+
- **API key**, where the SDK retrieves and refreshes a bearer token
|
|
57
|
+
- **Pre-generated JWT token**, managed outside the SDK
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- ``X-IBM-Client-Id``: saascore-{your-client-id}
|
|
59
|
-
- ``accept``: application/json
|
|
59
|
+
Using Personal Access Token (PAT)
|
|
60
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
- Token Generation Endpoint: https://api.ibm.com/saascore/run/authentication-retrieve/api-key
|
|
62
|
+
.. code-block:: javascript
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
import { Client } from 'emissions-api-sdk';
|
|
65
|
+
|
|
66
|
+
await Client.getClient({
|
|
67
|
+
patToken: process.env.ENVIZI_PAT_TOKEN,
|
|
68
|
+
clientId: process.env.ENVIZI_CLIENT_ID
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
.. note::
|
|
72
|
+
|
|
73
|
+
When using a PAT token, do not provide ``orgId``.
|
|
74
|
+
|
|
75
|
+
Using API Key
|
|
76
|
+
~~~~~~~~~~~~~
|
|
66
77
|
|
|
67
78
|
.. code-block:: javascript
|
|
68
79
|
|
|
69
80
|
import { Client } from 'emissions-api-sdk';
|
|
70
|
-
|
|
71
|
-
async function initialize() {
|
|
72
|
-
try {
|
|
73
|
-
await Client.getClient({
|
|
74
|
-
apiKey: "your-api-key",
|
|
75
|
-
clientId: "your-client-id",
|
|
76
|
-
orgId: "your-org-id"
|
|
77
|
-
});
|
|
78
|
-
console.log("Client initialized successfully");
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error("Failed to initialize client:", error);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
initialize();
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
await Client.getClient({
|
|
83
|
+
apiKey: process.env.ENVIZI_API_KEY,
|
|
84
|
+
clientId: process.env.ENVIZI_CLIENT_ID,
|
|
85
|
+
orgId: process.env.ENVIZI_ORG_ID
|
|
86
|
+
});
|
|
88
87
|
|
|
89
|
-
|
|
88
|
+
Using Pre-generated JWT Token
|
|
89
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
90
90
|
|
|
91
91
|
.. code-block:: javascript
|
|
92
92
|
|
|
93
93
|
import { Client } from 'emissions-api-sdk';
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
clientId: "your-client-id"
|
|
100
|
-
});
|
|
101
|
-
console.log("Client initialized successfully");
|
|
102
|
-
} catch (error) {
|
|
103
|
-
console.error("Failed to initialize client:", error);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
initialize();
|
|
95
|
+
await Client.getClient({
|
|
96
|
+
token: process.env.JWT_TOKEN,
|
|
97
|
+
clientId: process.env.ENVIZI_CLIENT_ID
|
|
98
|
+
});
|
|
108
99
|
|
|
109
100
|
First API Call
|
|
110
101
|
--------------
|
|
111
102
|
|
|
112
|
-
After initializing the client, you can make your first API call. Here's
|
|
103
|
+
After initializing the client, you can make your first API call. Here's a quick start example of calculating location-based emissions:
|
|
113
104
|
|
|
114
105
|
.. code-block:: javascript
|
|
115
106
|
|
|
116
|
-
import { Client,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
"activity": {
|
|
134
|
-
"type": "electricity",
|
|
135
|
-
"value": 1,
|
|
136
|
-
"unit": "kWh"
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
console.log("Emission calculation result:", result);
|
|
141
|
-
} catch (error) {
|
|
142
|
-
console.error("Error calculating emissions:", error);
|
|
107
|
+
import { Client, Location } from 'emissions-api-sdk';
|
|
108
|
+
|
|
109
|
+
await Client.getClient({
|
|
110
|
+
patToken: process.env.ENVIZI_PAT_TOKEN,
|
|
111
|
+
clientId: process.env.ENVIZI_CLIENT_ID
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const result = await Location.calculate({
|
|
115
|
+
"location": {
|
|
116
|
+
"country": "USA",
|
|
117
|
+
"stateProvince": "california"
|
|
118
|
+
},
|
|
119
|
+
"activity": {
|
|
120
|
+
"type": "electricity",
|
|
121
|
+
"value": 1,
|
|
122
|
+
"unit": "kWh"
|
|
143
123
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
calculateEmissions();
|
|
124
|
+
});
|
|
147
125
|
|
|
148
126
|
Example Response
|
|
149
127
|
----------------
|
|
@@ -162,3 +140,713 @@ The API returns emission calculation results in JSON format. Here's an example r
|
|
|
162
140
|
"unit": "kgCO2e",
|
|
163
141
|
"description": "The electricity emissions factor used to calculate this result was obtained from the year 2022 Managed - eGRID & US Climate Leaders factor set for the area United States and the region California."
|
|
164
142
|
}
|
|
143
|
+
|
|
144
|
+
Example Response with Details
|
|
145
|
+
------------------------------
|
|
146
|
+
|
|
147
|
+
When you need more detailed information about the emission factors used in calculations, you can request the response to include the ``details`` object. This provides comprehensive information about the factor set and specific factor used:
|
|
148
|
+
|
|
149
|
+
.. code-block:: json
|
|
150
|
+
|
|
151
|
+
{
|
|
152
|
+
"transactionId": "29df5ecd-fc3b-4797-b6fd-da03bc007f30",
|
|
153
|
+
"totalCO2e": 5912000,
|
|
154
|
+
"CO2": 5840000,
|
|
155
|
+
"CH4": 2000.0000000000002,
|
|
156
|
+
"N2O": 70000,
|
|
157
|
+
"indirectCO2e": 1340000,
|
|
158
|
+
"unit": "kgCO2e",
|
|
159
|
+
"description": "The Freight - Cargo Ship - Bulk Carrier - 0-9999 dwt emissions factor used to calculate this result was obtained from the DEFRA factor set for the Global region year 2025.",
|
|
160
|
+
"details": {
|
|
161
|
+
"factorSet": {
|
|
162
|
+
"name": "DEFRA",
|
|
163
|
+
"description": "The UK Government and DEFRA publish GHG emission factors covering Scope 1, Scope 2, and selected Scope 3 sources. While primarily intended for UK-based reporting, many organizations apply these factors across European sites—especially for air travel-related emissions.",
|
|
164
|
+
"provider": "His Majesty's Government (United Kingdom of Great Britain and Northern Ireland): Department for Energy Security and Net Zero",
|
|
165
|
+
"sourceUrl": "https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2024"
|
|
166
|
+
},
|
|
167
|
+
"factor": {
|
|
168
|
+
"name": "Bulk carrier - 0–9999 dwt - 2025",
|
|
169
|
+
"description": "Cargo ship - tonne.km",
|
|
170
|
+
"totalCO2e": 0.02956,
|
|
171
|
+
"CO2": 0.0292,
|
|
172
|
+
"CH4": 0.00001,
|
|
173
|
+
"N2O": 0.00035,
|
|
174
|
+
"indirectCO2e": 0.0067,
|
|
175
|
+
"inputUnit": "t-km",
|
|
176
|
+
"unit": "tonne.km",
|
|
177
|
+
"conversionRatio": "1:1",
|
|
178
|
+
"activityType": "Freight - Cargo Ship - Bulk Carrier - 0-9999 dwt",
|
|
179
|
+
"activitySubtype": "Default Factor",
|
|
180
|
+
"factorId": 190405,
|
|
181
|
+
"methodology": "activity-based",
|
|
182
|
+
"scopes": [
|
|
183
|
+
"3.4",
|
|
184
|
+
"3.9"
|
|
185
|
+
],
|
|
186
|
+
"areaName": "Earth",
|
|
187
|
+
"areaType": "Planet",
|
|
188
|
+
"publishedFrom": "2025-01-01",
|
|
189
|
+
"source": "2025 Greenhouse Gas Reporting: Conversion Factors 2025 (DEFRA) provided by gov.uk, license - https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
Response Structure Details
|
|
195
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
196
|
+
|
|
197
|
+
The response includes the following key components:
|
|
198
|
+
|
|
199
|
+
**Top-level Fields:**
|
|
200
|
+
|
|
201
|
+
- ``transactionId``: Unique identifier for the calculation
|
|
202
|
+
- ``totalCO2e``: Total CO2 equivalent emissions
|
|
203
|
+
- ``CO2``: Carbon dioxide emissions
|
|
204
|
+
- ``CH4``: Methane emissions
|
|
205
|
+
- ``N2O``: Nitrous oxide emissions
|
|
206
|
+
- ``indirectCO2e``: Indirect CO2 equivalent emissions
|
|
207
|
+
- ``unit``: Unit of measurement (typically kgCO2e)
|
|
208
|
+
- ``description``: Human-readable description of the calculation
|
|
209
|
+
|
|
210
|
+
**Details Object (when requested):**
|
|
211
|
+
|
|
212
|
+
The ``details`` object provides comprehensive information about the emission factors:
|
|
213
|
+
|
|
214
|
+
*Factor Set Information:*
|
|
215
|
+
|
|
216
|
+
- ``name``: Name of the factor set (e.g., DEFRA, EPA)
|
|
217
|
+
- ``description``: Detailed description of the factor set
|
|
218
|
+
- ``provider``: Organization that provides the factor set
|
|
219
|
+
- ``sourceUrl``: URL to the source documentation
|
|
220
|
+
|
|
221
|
+
*Factor Information:*
|
|
222
|
+
|
|
223
|
+
- ``name``: Specific name of the emission factor
|
|
224
|
+
- ``description``: Description of the factor
|
|
225
|
+
- ``totalCO2e``, ``CO2``, ``CH4``, ``N2O``, ``indirectCO2e``: Emission values per unit
|
|
226
|
+
- ``inputUnit``: Unit for input values
|
|
227
|
+
- ``unit``: Unit of the factor
|
|
228
|
+
- ``conversionRatio``: Conversion ratio applied
|
|
229
|
+
- ``activityType``: Type of activity (e.g., transportation, energy)
|
|
230
|
+
- ``activitySubtype``: Subtype classification
|
|
231
|
+
- ``factorId``: Unique identifier for the factor
|
|
232
|
+
- ``methodology``: Calculation methodology used
|
|
233
|
+
- ``scopes``: Applicable GHG Protocol scopes
|
|
234
|
+
- ``areaName``: Geographic area name
|
|
235
|
+
- ``areaType``: Type of geographic area
|
|
236
|
+
- ``publishedFrom``: Date from which the factor is valid
|
|
237
|
+
|
|
238
|
+
Currency Conversion Support
|
|
239
|
+
---------------------------
|
|
240
|
+
|
|
241
|
+
Overview
|
|
242
|
+
~~~~~~~~
|
|
243
|
+
|
|
244
|
+
The SDK supports automatic currency conversion for API methods that accept monetary values. This feature allows you to input values in your preferred currency, and the system will automatically convert them to the appropriate base currency for emissions calculations.
|
|
245
|
+
|
|
246
|
+
**Supported Methods**
|
|
247
|
+
|
|
248
|
+
Currency conversion is available for the following calculation methods:
|
|
249
|
+
|
|
250
|
+
- ``EconomicActivity.calculate()``
|
|
251
|
+
- ``Calculation.calculate()``
|
|
252
|
+
|
|
253
|
+
Supported Currencies
|
|
254
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
255
|
+
|
|
256
|
+
The SDK supports conversion for 170 currencies:
|
|
257
|
+
|
|
258
|
+
.. list-table::
|
|
259
|
+
:header-rows: 1
|
|
260
|
+
:widths: 60 40
|
|
261
|
+
|
|
262
|
+
* - Currency Name
|
|
263
|
+
- Symbol
|
|
264
|
+
* - ADB Unit of Account
|
|
265
|
+
- XUA
|
|
266
|
+
* - Afghani
|
|
267
|
+
- AFN
|
|
268
|
+
* - Algerian Dinar
|
|
269
|
+
- DZD
|
|
270
|
+
* - Arab Accounting Dinar
|
|
271
|
+
- XAD
|
|
272
|
+
* - Argentine Peso
|
|
273
|
+
- ARS
|
|
274
|
+
* - Armenian Dram
|
|
275
|
+
- AMD
|
|
276
|
+
* - Aruban Florin
|
|
277
|
+
- AWG
|
|
278
|
+
* - Australian Dollar
|
|
279
|
+
- AUD
|
|
280
|
+
* - Azerbaijan Manat
|
|
281
|
+
- AZN
|
|
282
|
+
* - Bahamian Dollar
|
|
283
|
+
- BSD
|
|
284
|
+
* - Bahraini Dinar
|
|
285
|
+
- BHD
|
|
286
|
+
* - Baht
|
|
287
|
+
- THB
|
|
288
|
+
* - Balboa
|
|
289
|
+
- PAB
|
|
290
|
+
* - Barbados Dollar
|
|
291
|
+
- BBD
|
|
292
|
+
* - Belarusian Ruble
|
|
293
|
+
- BYN
|
|
294
|
+
* - Belize Dollar
|
|
295
|
+
- BZD
|
|
296
|
+
* - Bermudian Dollar
|
|
297
|
+
- BMD
|
|
298
|
+
* - Boliviano
|
|
299
|
+
- BOB
|
|
300
|
+
* - Bolívar Soberano
|
|
301
|
+
- VED
|
|
302
|
+
* - Bolívar Soberano
|
|
303
|
+
- VES
|
|
304
|
+
* - Brazilian Real
|
|
305
|
+
- BRL
|
|
306
|
+
* - Brunei Dollar
|
|
307
|
+
- BND
|
|
308
|
+
* - Bulgarian Lev
|
|
309
|
+
- BGN
|
|
310
|
+
* - Burundi Franc
|
|
311
|
+
- BIF
|
|
312
|
+
* - Cabo Verde Escudo
|
|
313
|
+
- CVE
|
|
314
|
+
* - Canadian Dollar
|
|
315
|
+
- CAD
|
|
316
|
+
* - Caribbean Guilder
|
|
317
|
+
- XCG
|
|
318
|
+
* - Cayman Islands Dollar
|
|
319
|
+
- KYD
|
|
320
|
+
* - CFA Franc BCEAO
|
|
321
|
+
- XOF
|
|
322
|
+
* - CFA Franc BEAC
|
|
323
|
+
- XAF
|
|
324
|
+
* - CFP Franc
|
|
325
|
+
- XPF
|
|
326
|
+
* - Chilean Peso
|
|
327
|
+
- CLP
|
|
328
|
+
* - Colombian Peso
|
|
329
|
+
- COP
|
|
330
|
+
* - Comorian Franc
|
|
331
|
+
- KMF
|
|
332
|
+
* - Congolese Franc
|
|
333
|
+
- CDF
|
|
334
|
+
* - Convertible Mark
|
|
335
|
+
- BAM
|
|
336
|
+
* - Cordoba Oro
|
|
337
|
+
- NIO
|
|
338
|
+
* - Costa Rican Colon
|
|
339
|
+
- CRC
|
|
340
|
+
* - Cuban Peso
|
|
341
|
+
- CUP
|
|
342
|
+
* - Czech Koruna
|
|
343
|
+
- CZK
|
|
344
|
+
* - Dalasi
|
|
345
|
+
- GMD
|
|
346
|
+
* - Danish Krone
|
|
347
|
+
- DKK
|
|
348
|
+
* - Denar
|
|
349
|
+
- MKD
|
|
350
|
+
* - Djibouti Franc
|
|
351
|
+
- DJF
|
|
352
|
+
* - Dobra
|
|
353
|
+
- STN
|
|
354
|
+
* - Dominican Peso
|
|
355
|
+
- DOP
|
|
356
|
+
* - Dong
|
|
357
|
+
- VND
|
|
358
|
+
* - East Caribbean Dollar
|
|
359
|
+
- XCD
|
|
360
|
+
* - Egyptian Pound
|
|
361
|
+
- EGP
|
|
362
|
+
* - El Salvador Colon
|
|
363
|
+
- SVC
|
|
364
|
+
* - Ethiopian Birr
|
|
365
|
+
- ETB
|
|
366
|
+
* - Euro
|
|
367
|
+
- EUR
|
|
368
|
+
* - Falkland Islands Pound
|
|
369
|
+
- FKP
|
|
370
|
+
* - Fiji Dollar
|
|
371
|
+
- FJD
|
|
372
|
+
* - Forint
|
|
373
|
+
- HUF
|
|
374
|
+
* - Ghana Cedi
|
|
375
|
+
- GHS
|
|
376
|
+
* - Gibraltar Pound
|
|
377
|
+
- GIP
|
|
378
|
+
* - Gourde
|
|
379
|
+
- HTG
|
|
380
|
+
* - Guarani
|
|
381
|
+
- PYG
|
|
382
|
+
* - Guinean Franc
|
|
383
|
+
- GNF
|
|
384
|
+
* - Guyana Dollar
|
|
385
|
+
- GYD
|
|
386
|
+
* - Hong Kong Dollar
|
|
387
|
+
- HKD
|
|
388
|
+
* - Hryvnia
|
|
389
|
+
- UAH
|
|
390
|
+
* - Iceland Krona
|
|
391
|
+
- ISK
|
|
392
|
+
* - Indian Rupee
|
|
393
|
+
- INR
|
|
394
|
+
* - Iranian Rial
|
|
395
|
+
- IRR
|
|
396
|
+
* - Iraqi Dinar
|
|
397
|
+
- IQD
|
|
398
|
+
* - Jamaican Dollar
|
|
399
|
+
- JMD
|
|
400
|
+
* - Jordanian Dinar
|
|
401
|
+
- JOD
|
|
402
|
+
* - Kenyan Shilling
|
|
403
|
+
- KES
|
|
404
|
+
* - Kina
|
|
405
|
+
- PGK
|
|
406
|
+
* - Kuwaiti Dinar
|
|
407
|
+
- KWD
|
|
408
|
+
* - Kwanza
|
|
409
|
+
- AOA
|
|
410
|
+
* - Kyat
|
|
411
|
+
- MMK
|
|
412
|
+
* - Lao Kip
|
|
413
|
+
- LAK
|
|
414
|
+
* - Lari
|
|
415
|
+
- GEL
|
|
416
|
+
* - Lebanese Pound
|
|
417
|
+
- LBP
|
|
418
|
+
* - Lek
|
|
419
|
+
- ALL
|
|
420
|
+
* - Lempira
|
|
421
|
+
- HNL
|
|
422
|
+
* - Leone
|
|
423
|
+
- SLE
|
|
424
|
+
* - Liberian Dollar
|
|
425
|
+
- LRD
|
|
426
|
+
* - Libyan Dinar
|
|
427
|
+
- LYD
|
|
428
|
+
* - Lilangeni
|
|
429
|
+
- SZL
|
|
430
|
+
* - Loti
|
|
431
|
+
- LSL
|
|
432
|
+
* - Malagasy Ariary
|
|
433
|
+
- MGA
|
|
434
|
+
* - Malawi Kwacha
|
|
435
|
+
- MWK
|
|
436
|
+
* - Malaysian Ringgit
|
|
437
|
+
- MYR
|
|
438
|
+
* - Mauritius Rupee
|
|
439
|
+
- MUR
|
|
440
|
+
* - Mexican Peso
|
|
441
|
+
- MXN
|
|
442
|
+
* - Mexican Unidad de Inversion (UDI)
|
|
443
|
+
- MXV
|
|
444
|
+
* - Moldovan Leu
|
|
445
|
+
- MDL
|
|
446
|
+
* - Moroccan Dirham
|
|
447
|
+
- MAD
|
|
448
|
+
* - Mozambique Metical
|
|
449
|
+
- MZN
|
|
450
|
+
* - Mvdol
|
|
451
|
+
- BOV
|
|
452
|
+
* - Naira
|
|
453
|
+
- NGN
|
|
454
|
+
* - Nakfa
|
|
455
|
+
- ERN
|
|
456
|
+
* - Namibia Dollar
|
|
457
|
+
- NAD
|
|
458
|
+
* - Nepalese Rupee
|
|
459
|
+
- NPR
|
|
460
|
+
* - Netherlands Antillean Guilder
|
|
461
|
+
- ANG
|
|
462
|
+
* - New Israeli Sheqel
|
|
463
|
+
- ILS
|
|
464
|
+
* - New Taiwan Dollar
|
|
465
|
+
- TWD
|
|
466
|
+
* - New Zealand Dollar
|
|
467
|
+
- NZD
|
|
468
|
+
* - Ngultrum
|
|
469
|
+
- BTN
|
|
470
|
+
* - North Korean Won
|
|
471
|
+
- KPW
|
|
472
|
+
* - Norwegian Krone
|
|
473
|
+
- NOK
|
|
474
|
+
* - Ouguiya
|
|
475
|
+
- MRU
|
|
476
|
+
* - Pa'anga
|
|
477
|
+
- TOP
|
|
478
|
+
* - Pakistan Rupee
|
|
479
|
+
- PKR
|
|
480
|
+
* - Pataca
|
|
481
|
+
- MOP
|
|
482
|
+
* - Peso Uruguayo
|
|
483
|
+
- UYU
|
|
484
|
+
* - Philippine Peso
|
|
485
|
+
- PHP
|
|
486
|
+
* - Pound Sterling
|
|
487
|
+
- GBP
|
|
488
|
+
* - Pula
|
|
489
|
+
- BWP
|
|
490
|
+
* - Qatari Rial
|
|
491
|
+
- QAR
|
|
492
|
+
* - Quetzal
|
|
493
|
+
- GTQ
|
|
494
|
+
* - Rand
|
|
495
|
+
- ZAR
|
|
496
|
+
* - Rial Omani
|
|
497
|
+
- OMR
|
|
498
|
+
* - Riel
|
|
499
|
+
- KHR
|
|
500
|
+
* - Romanian Leu
|
|
501
|
+
- RON
|
|
502
|
+
* - Rufiyaa
|
|
503
|
+
- MVR
|
|
504
|
+
* - Rupiah
|
|
505
|
+
- IDR
|
|
506
|
+
* - Russian Ruble
|
|
507
|
+
- RUB
|
|
508
|
+
* - Rwanda Franc
|
|
509
|
+
- RWF
|
|
510
|
+
* - Saint Helena Pound
|
|
511
|
+
- SHP
|
|
512
|
+
* - Saudi Riyal
|
|
513
|
+
- SAR
|
|
514
|
+
* - SDR (Special Drawing Right)
|
|
515
|
+
- XDR
|
|
516
|
+
* - Serbian Dinar
|
|
517
|
+
- RSD
|
|
518
|
+
* - Seychelles Rupee
|
|
519
|
+
- SCR
|
|
520
|
+
* - Singapore Dollar
|
|
521
|
+
- SGD
|
|
522
|
+
* - Sol
|
|
523
|
+
- PEN
|
|
524
|
+
* - Solomon Islands Dollar
|
|
525
|
+
- SBD
|
|
526
|
+
* - Som
|
|
527
|
+
- KGS
|
|
528
|
+
* - Somali Shilling
|
|
529
|
+
- SOS
|
|
530
|
+
* - Somoni
|
|
531
|
+
- TJS
|
|
532
|
+
* - South Sudanese Pound
|
|
533
|
+
- SSP
|
|
534
|
+
* - Sri Lanka Rupee
|
|
535
|
+
- LKR
|
|
536
|
+
* - Sucre
|
|
537
|
+
- XSU
|
|
538
|
+
* - Sudanese Pound
|
|
539
|
+
- SDG
|
|
540
|
+
* - Surinam Dollar
|
|
541
|
+
- SRD
|
|
542
|
+
* - Swedish Krona
|
|
543
|
+
- SEK
|
|
544
|
+
* - Swiss Franc
|
|
545
|
+
- CHF
|
|
546
|
+
* - Syrian Pound
|
|
547
|
+
- SYP
|
|
548
|
+
* - Taka
|
|
549
|
+
- BDT
|
|
550
|
+
* - Tala
|
|
551
|
+
- WST
|
|
552
|
+
* - Tanzanian Shilling
|
|
553
|
+
- TZS
|
|
554
|
+
* - Tenge
|
|
555
|
+
- KZT
|
|
556
|
+
* - Trinidad and Tobago Dollar
|
|
557
|
+
- TTD
|
|
558
|
+
* - Tugrik
|
|
559
|
+
- MNT
|
|
560
|
+
* - Tunisian Dinar
|
|
561
|
+
- TND
|
|
562
|
+
* - Turkish Lira
|
|
563
|
+
- TRY
|
|
564
|
+
* - Turkmenistan New Manat
|
|
565
|
+
- TMT
|
|
566
|
+
* - UAE Dirham
|
|
567
|
+
- AED
|
|
568
|
+
* - Uganda Shilling
|
|
569
|
+
- UGX
|
|
570
|
+
* - Unidad de Fomento
|
|
571
|
+
- CLF
|
|
572
|
+
* - Unidad de Valor Real
|
|
573
|
+
- COU
|
|
574
|
+
* - Unidad Previsional
|
|
575
|
+
- UYW
|
|
576
|
+
* - United States dollar
|
|
577
|
+
- USD
|
|
578
|
+
* - Uruguay Peso en Unidades Indexadas (UI)
|
|
579
|
+
- UYI
|
|
580
|
+
* - US Dollar (Next day)
|
|
581
|
+
- USN
|
|
582
|
+
* - Uzbekistan Sum
|
|
583
|
+
- UZS
|
|
584
|
+
* - Vatu
|
|
585
|
+
- VUV
|
|
586
|
+
* - WIR Euro
|
|
587
|
+
- CHE
|
|
588
|
+
* - WIR Franc
|
|
589
|
+
- CHW
|
|
590
|
+
* - Won
|
|
591
|
+
- KRW
|
|
592
|
+
* - Yemeni Rial
|
|
593
|
+
- YER
|
|
594
|
+
* - Yen
|
|
595
|
+
- JPY
|
|
596
|
+
* - Yuan Renminbi
|
|
597
|
+
- CNY
|
|
598
|
+
* - Zambian Kwacha
|
|
599
|
+
- ZMW
|
|
600
|
+
* - Zimbabwe Gold
|
|
601
|
+
- ZWG
|
|
602
|
+
* - Zloty
|
|
603
|
+
- PLN
|
|
604
|
+
|
|
605
|
+
Exchange Rate Data
|
|
606
|
+
~~~~~~~~~~~~~~~~~~
|
|
607
|
+
|
|
608
|
+
**Data Source**
|
|
609
|
+
|
|
610
|
+
Exchange rates are sourced from the U.S. Department of the Treasury's Fiscal Data API, which provides official exchange rates used by the U.S. government for accounting and reporting purposes.
|
|
611
|
+
|
|
612
|
+
- **API Source**: https://api.fiscaldata.treasury.gov/services/api/fiscal_service
|
|
613
|
+
- **Data Provider**: U.S. Department of the Treasury, Bureau of the Fiscal Service
|
|
614
|
+
|
|
615
|
+
**Historical Coverage**
|
|
616
|
+
|
|
617
|
+
Exchange rate data is available from **March 31, 2001** onwards. If you specify a date earlier than this, the system will use the earliest available rate.
|
|
618
|
+
|
|
619
|
+
**Data Updates**
|
|
620
|
+
|
|
621
|
+
The exchange rate database is automatically synchronized with the Treasury API to ensure you always have access to the most current rates. Updates are captured as soon as they become available from the Treasury.
|
|
622
|
+
|
|
623
|
+
- **Update Frequency**: The U.S. Treasury typically publishes exchange rates on a **quarterly basis**
|
|
624
|
+
- **Amendment Policy**: If current rates deviate from the published rates by 10% or more, Treasury will issue amendments to the quarterly report
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
- ``source``: Source citation and license information
|
|
628
|
+
|
|
629
|
+
Finance Emissions APIs
|
|
630
|
+
----------------------
|
|
631
|
+
|
|
632
|
+
The SDK supports three scope 3 finance-based emission APIs: **Real Estate**, **Physical Activity**, and **Economic Activity**. Each supports optional PCAF attribution to proportionally allocate emissions.
|
|
633
|
+
|
|
634
|
+
Real Estate
|
|
635
|
+
~~~~~~~~~~~
|
|
636
|
+
|
|
637
|
+
Real Estate calculates scope 3 emissions from commercial and residential property. Attribution uses ``propertyValue`` to compute an attribution factor.
|
|
638
|
+
|
|
639
|
+
**Without attribution:**
|
|
640
|
+
|
|
641
|
+
.. code-block:: javascript
|
|
642
|
+
|
|
643
|
+
const result = await RealEstate.calculate({
|
|
644
|
+
"time": { "date": "2022-01-01" },
|
|
645
|
+
"location": { "country": "usa", "stateProvince": "new york" },
|
|
646
|
+
"activity": {
|
|
647
|
+
"type": "Commercial Real Estate:Office",
|
|
648
|
+
"value": 123456.0,
|
|
649
|
+
"unit": "m2"
|
|
650
|
+
},
|
|
651
|
+
"includeDetails": false
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
**With attribution (property value based):**
|
|
655
|
+
|
|
656
|
+
.. code-block:: javascript
|
|
657
|
+
|
|
658
|
+
const result = await RealEstate.calculate({
|
|
659
|
+
"time": { "date": "2022-01-01" },
|
|
660
|
+
"location": { "country": "usa", "stateProvince": "new york" },
|
|
661
|
+
"activity": {
|
|
662
|
+
"type": "Commercial Real Estate:Office",
|
|
663
|
+
"value": 123456.0,
|
|
664
|
+
"unit": "m2"
|
|
665
|
+
},
|
|
666
|
+
"attribution": {
|
|
667
|
+
"outstandingAmount": 1000000.0,
|
|
668
|
+
"propertyValue": 5000000.0
|
|
669
|
+
},
|
|
670
|
+
"includeDetails": true
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
.. note::
|
|
674
|
+
|
|
675
|
+
Real estate attribution only accepts ``propertyValue``. Using ``totalEquity``, ``totalDebt``, ``evic``, or ``revenue`` will result in a 400 error.
|
|
676
|
+
|
|
677
|
+
Physical Activity
|
|
678
|
+
~~~~~~~~~~~~~~~~~
|
|
679
|
+
|
|
680
|
+
Physical Activity calculates scope 3 emissions from physical activities. Attribution supports two methods: equity/debt for private companies, or EVIC for listed companies.
|
|
681
|
+
|
|
682
|
+
**Without attribution:**
|
|
683
|
+
|
|
684
|
+
.. code-block:: javascript
|
|
685
|
+
|
|
686
|
+
const result = await PhysicalActivity.calculate({
|
|
687
|
+
"time": { "date": "2022-01-01" },
|
|
688
|
+
"location": { "country": "usa", "stateProvince": "new york" },
|
|
689
|
+
"activity": {
|
|
690
|
+
"type": "Physical Activity Type",
|
|
691
|
+
"value": 123456.0,
|
|
692
|
+
"unit": "kg"
|
|
693
|
+
},
|
|
694
|
+
"includeDetails": false
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
**With attribution (equity/debt — private companies):**
|
|
698
|
+
|
|
699
|
+
.. code-block:: javascript
|
|
700
|
+
|
|
701
|
+
const result = await PhysicalActivity.calculate({
|
|
702
|
+
"time": { "date": "2022-01-01" },
|
|
703
|
+
"location": { "country": "usa", "stateProvince": "new york" },
|
|
704
|
+
"activity": {
|
|
705
|
+
"type": "Physical Activity Type",
|
|
706
|
+
"value": 123456.0,
|
|
707
|
+
"unit": "kg"
|
|
708
|
+
},
|
|
709
|
+
"attribution": {
|
|
710
|
+
"outstandingAmount": 1000000.0,
|
|
711
|
+
"totalEquity": 3000000.0,
|
|
712
|
+
"totalDebt": 2000000.0
|
|
713
|
+
},
|
|
714
|
+
"includeDetails": true
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
**With attribution (EVIC — listed companies):**
|
|
718
|
+
|
|
719
|
+
.. code-block:: javascript
|
|
720
|
+
|
|
721
|
+
const result = await PhysicalActivity.calculate({
|
|
722
|
+
"time": { "date": "2022-01-01" },
|
|
723
|
+
"location": { "country": "usa", "stateProvince": "new york" },
|
|
724
|
+
"activity": {
|
|
725
|
+
"type": "Physical Activity Type",
|
|
726
|
+
"value": 123456.0,
|
|
727
|
+
"unit": "kg"
|
|
728
|
+
},
|
|
729
|
+
"attribution": {
|
|
730
|
+
"outstandingAmount": 1000000.0,
|
|
731
|
+
"evic": 10000000.0
|
|
732
|
+
},
|
|
733
|
+
"includeDetails": true
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
.. note::
|
|
737
|
+
|
|
738
|
+
Physical activity attribution does not accept ``propertyValue`` or ``revenue``. Use ``totalEquity + totalDebt`` for private companies, or ``evic`` for listed companies — not both.
|
|
739
|
+
|
|
740
|
+
Economic Activity
|
|
741
|
+
~~~~~~~~~~~~~~~~~
|
|
742
|
+
|
|
743
|
+
Economic Activity calculates scope 3 spend-based emissions. Attribution supports equity/debt, EVIC, or revenue-based allocation.
|
|
744
|
+
|
|
745
|
+
**Without attribution:**
|
|
746
|
+
|
|
747
|
+
.. code-block:: javascript
|
|
748
|
+
|
|
749
|
+
const result = await EconomicActivity.calculate({
|
|
750
|
+
"time": { "date": "2022-01-01" },
|
|
751
|
+
"location": { "country": "usa", "stateProvince": "new york" },
|
|
752
|
+
"activity": {
|
|
753
|
+
"type": "Accomodation",
|
|
754
|
+
"value": 123456.0,
|
|
755
|
+
"unit": "usd"
|
|
756
|
+
},
|
|
757
|
+
"includeDetails": false
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
**With attribution (revenue based):**
|
|
761
|
+
|
|
762
|
+
.. code-block:: javascript
|
|
763
|
+
|
|
764
|
+
const result = await EconomicActivity.calculate({
|
|
765
|
+
"time": { "date": "2025-01-04" },
|
|
766
|
+
"location": { "country": "usa" },
|
|
767
|
+
"activity": {
|
|
768
|
+
"type": "accomodation",
|
|
769
|
+
"value": 1500.12,
|
|
770
|
+
"unit": "usd"
|
|
771
|
+
},
|
|
772
|
+
"attribution": {
|
|
773
|
+
"outstandingAmount": 500000.0,
|
|
774
|
+
"revenue": 2000000.0
|
|
775
|
+
},
|
|
776
|
+
"includeDetails": true
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
**With attribution (equity/debt — private companies):**
|
|
780
|
+
|
|
781
|
+
.. code-block:: javascript
|
|
782
|
+
|
|
783
|
+
const result = await EconomicActivity.calculate({
|
|
784
|
+
"time": { "date": "2025-01-04" },
|
|
785
|
+
"location": { "country": "usa" },
|
|
786
|
+
"activity": {
|
|
787
|
+
"type": "accomodation",
|
|
788
|
+
"value": 1500.12,
|
|
789
|
+
"unit": "usd"
|
|
790
|
+
},
|
|
791
|
+
"attribution": {
|
|
792
|
+
"outstandingAmount": 500000.0,
|
|
793
|
+
"totalEquity": 3000000.0,
|
|
794
|
+
"totalDebt": 2000000.0
|
|
795
|
+
},
|
|
796
|
+
"includeDetails": true
|
|
797
|
+
});
|
|
798
|
+
|
|
799
|
+
**With attribution (EVIC — listed companies):**
|
|
800
|
+
|
|
801
|
+
.. code-block:: javascript
|
|
802
|
+
|
|
803
|
+
const result = await EconomicActivity.calculate({
|
|
804
|
+
"time": { "date": "2025-01-04" },
|
|
805
|
+
"location": { "country": "usa" },
|
|
806
|
+
"activity": {
|
|
807
|
+
"type": "accomodation",
|
|
808
|
+
"value": 1500.12,
|
|
809
|
+
"unit": "usd"
|
|
810
|
+
},
|
|
811
|
+
"attribution": {
|
|
812
|
+
"outstandingAmount": 500000.0,
|
|
813
|
+
"evic": 10000000.0
|
|
814
|
+
},
|
|
815
|
+
"includeDetails": true
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
.. note::
|
|
819
|
+
|
|
820
|
+
``propertyValue`` is not supported for economic activity. ``totalEquity`` and ``totalDebt`` must always be provided together.
|
|
821
|
+
|
|
822
|
+
Attribution Summary
|
|
823
|
+
~~~~~~~~~~~~~~~~~~~
|
|
824
|
+
|
|
825
|
+
.. list-table::
|
|
826
|
+
:header-rows: 1
|
|
827
|
+
:widths: 30 14 20 12 12 12
|
|
828
|
+
|
|
829
|
+
* - API
|
|
830
|
+
- ``propertyValue``
|
|
831
|
+
- ``totalEquity`` + ``totalDebt``
|
|
832
|
+
- ``evic``
|
|
833
|
+
- ``revenue``
|
|
834
|
+
- ``outstandingAmount``
|
|
835
|
+
* - Real Estate
|
|
836
|
+
- ✓
|
|
837
|
+
- ✗
|
|
838
|
+
- ✗
|
|
839
|
+
- ✗
|
|
840
|
+
- Required
|
|
841
|
+
* - Physical Activity
|
|
842
|
+
- ✗
|
|
843
|
+
- ✓
|
|
844
|
+
- ✓
|
|
845
|
+
- ✗
|
|
846
|
+
- Required
|
|
847
|
+
* - Economic Activity
|
|
848
|
+
- ✗
|
|
849
|
+
- ✓
|
|
850
|
+
- ✓
|
|
851
|
+
- ✓
|
|
852
|
+
- Required
|