Client libraries
Getting Started
To make it easy to build your Duffel integration, we offer client libraries in C#, Java, JavaScript, PHP, Python, and Ruby.
Node.js
If you're using JavaScript, first install the library using your favourite package manager:
Shell (using yarn)
yarn add @duffel/api
Then import it into your codebase and initialise it with your access token:
JavaScript
import { Duffel } from '@duffel/api'const duffel = new Duffel({token:YOUR_ACCESS_TOKEN,})
View the repository on GitHub and check out the npm package:
duffelhq/duffel-api-javascript
The JavaScript client library for the Duffel API on GitHub
@duffel/api
JavaScript client library for the Duffel API
Python
If you're using Python, first install the library using
pip
:Python
pip install duffel-api
Then import it into your codebase and initialise it with your access token:
Python
from duffel_api import Duffelduffel = Duffel(access_token=$YOUR_ACCESS_TOKEN)
View the repository on GitHub and check out the python package page:
duffelhq/duffel-api-python
The Python client library for the Duffel API on GitHub
duffel-api
Python client library for the Duffel API
Ruby
If you're using Ruby, first install the library using Bundler:
Ruby
gem add duffel_api
Then import it into your codebase and initialise it with your access token:
Ruby
require "duffel_api"duffel = DuffelAPI::Client.new(access_token:$YOUR_ACCESS_TOKEN)
View the repository on GitHub and check out the ruby gem page:
duffelhq/duffel-api-ruby
The Ruby client for the Duffel API on GitHub
duffel_api
Ruby client for the Duffel API
C#
If you're using C#, first install the library using NuGet:
C#
Install-Package Duffel.ApiClient
Then import it into your codebase and initialise it with your access token:
C#
using Duffel.ApiClient;var duffel = new DuffelApiClient(accessToken: $"{YOUR_ACCESS_TOKEN}", production: true);
View the repository on GitHub and check out the NuGet page:
duffelhq/duffel-api-dotnet
The .NET client for the Duffel API on GitHub
Duffel.ApiClient
.NET client for the Duffel API
Java
If you're using Java, add the dependency to your project with Maven:
<dependency><groupId>com.duffel</groupId><artifactId>duffel-api</artifactId><version>1.0.1</version></dependency>
or Gradle:
implementation 'com.duffel:duffel-api:1.0.1'
Then import it into your codebase and initialise it with your access token:
import com.duffel.DuffelApiClient;DuffelApiClient client = new DuffelApiClient("$API_KEY");
View the repository on GitHub and check out the Maven page:
duffelhq/duffel-api-java
The Java client for the Duffel API on GitHub
com.duffel:duffel-api
Java client for the Duffel API