Skip to main content

Easily Integrate
Ducky's API using Konfig's TypeScript SDK

Need a TypeScript SDK for Ducky's API?

Growing API Companies trust Konfig's SDKs to onboard developers to their API.

SnapTradeHumanloopSplititLeapGroundx

First, instantiate the SDK

It only takes a few lines of code.

index.ts

import { Ducky } from 'ducky-typescript-sdk';
const ducky = new Ducky({
/*
* Protected requests expect the `Authorization` header with a bearer token respecting the format `Bearer $ACCESS_TOKEN`.
*
* This **documentation is interactive**: set your `access_token` here and test all requests directly from your browser
* (`access_token` must be formatted as `Bearer $ACCESS_TOKEN`).
* Or set it individually for each request, in the `Authorization` header.
*
*
* ### Introduction
* The API requires an `access_token` for every request (except [/ping](https://storage.googleapis.com)).
*
* Step-by-step:
* 1. [Ask Ducky](mailto:api@ducky.eco) for a `CLIENT_ID` and a `CLIENT_SECRET`
* 2. Negotiate an `access_token` with Auth0
* 3. Send authenticated requests to Ducky API
*
* Keep reading to learn how to obtain an `access_token` and use it to perform requests.
*
* ---
*
* ### Prerequisite
* To use the API, you have to get `CLIENT_ID` and a `CLIENT_SECRET`.
* To do so, please contact Ducky at [api@ducky.eco](mailto:api@ducky.eco).
*
* > Note: even without an `access_token`, you can browse the documentation and explore its possibilities by looking at the example outputs.
*
*
* ### Getting an access token
* #### Request
* Authentication is provided by Auth0. Before using Ducky API, you send a query to Auth0, asking for an `access_token`.
*
* To negotiate an `access_token`, send a request based on this curl snippet (update it with your `$CLIENT_ID`& `$CLIENT_SECRET`):
*
* ```shell
* curl --request POST \
* --url https://ducky-prod.eu.auth0.com/oauth/token \
* --header 'content-type: application/json' \
* --data '{"client_id":"$CLIENT_ID","client_secret":"$CLIENT_SECRET","audience":"ducky-api-prod","grant_type":"client_credentials"}'
* ```
*
* #### Response
* The response contains an `access_token` and an expiration time. You should store both and use the `access_token` until its expiration date. After expiration, repeat the process above to negotiate a new token.
*
* ```json
* {
* "access_token": "example_access_token",
* "token_type": "Bearer",
* "expires_in": 86400
* }
* ```
* ```
*
* ### Usage
* Now that you have an `access_token`, you can start using the Ducky API.
* Send the `access_token` with each request, in an `Authorization` header.
* Make sure to prefix it with the `token_type` which is always `Bearer`.
*
* ##### Example
* To make sure you're ready to use the API, you can use the [/ping/protected endpoint](https://storage.googleapis.com).
* It validates your `access_token` and checks if the API is ready to accept connections.
*
* ```shell
* curl --request GET \
* --url https://api.ducky.eco/v3/ping/protected \
* --header 'authorization: Bearer example_access_token'
* ```
*
*/
apiKeyAuth: "AUTHORIZATION"
})

Then, send your first request

We made it really easy.

index.ts

// Get kgCO2e per monetary transaction
const financialFootprintForTransactionsResponse = ducky.calculate.financialFootprintForTransactions({
dataSource: "norway"
categoryMapping: "ducky"
})

Enjoy a buttery smooth developer experience with 22 SDK methods

How Konfig Works

Konfig collects APIs and automatically generates SDKs so you can focus on building your application.

openapi-examples

Konfig maintains the highest quality collection of OpenAPI Specifications on the internet in a GitHub repository

We pull OpenAPI Specifications from public sources, fix any errors, and make sure they pass our lint rules. We continually make sure the repository is up-to-date and collect up-time and response time metrics for every API.

openapi-examples-to-konfig

Generates AI-Augmented SDKs from openapi-examples

Our SDK generator is trusted by growing API companies and goes through a rigorous testing process to ensure the generated SDKs are high-quality and easy to use.

konfig-to-package-managers

Publishes to standard package managers

We publish to standard package managers like npm, PyPI, and Maven so you can easily integrate the SDK into your application.

Ducky

About Ducky

Hello there! 👋🏼 We're Ducky, climate enthusiasts passionate about steering the world towards data-driven climate action. We empower YOU to seamlessly track, reduce, and report your climate emissions with our intuitive software solutions. 💪🏼 So far, we've assisted over 300 organisations and 90,000 individuals worldwide in becoming more sustainable – and we'd love to help you, too! Would any of our solutions be suitable for you?👇🏽 🌍 Seamless Climate Reporting: Initiate climate reporting easily, quickly, and at an affordable price! Our platform automates climate reporting according to all requirements, ensuring excellent results with just a few clicks and a user-friendly interface. 🚲 Holistic Mobility Data: In collaboration with Telia, we provide data to assist mobility planners and property developers in transitioning to a sustainable mobility system in your city. Track travel patterns and measure the climate impact of changes over time. 🌱 Climate Campaign Manager: Turn climate actions into a fun, team-building, and engaging process. Set up educational climate challenges within your company and foster a culture where climate action feels like a shared responsibility. 🎯 We focus on consumption-based carbon emissions. 🦆 Our team comprises 18 dedicated climate enthusiasts. 📍 We have offices in Trondheim and Oslo. 💬 Get in touch with us via DM or through our website: www.ducky.eco

Keywords

sustainability
climate_action
climate_reporting
data_driven
environmental_technology
climate_management
climate_solutions
climate_impact_measurement
climate_data_api
climate_software
climate_awareness
climate_data

Start integrating Ducky's API with Konfig