Developer-friendly & type-safe Java SDK specifically catered to leverage public-api API.
airbyte-api: Programmatically control Airbyte Cloud, OSS & Enterprise.
JDK 11 or later is required.
The samples below show how a published SDK artifact is used:
Gradle:
implementation 'com.airbyte:api:2.0.0'
Maven:
<dependency>
<groupId>com.airbyte</groupId>
<artifactId>api</artifactId>
<version>2.0.0</version>
</dependency>
After cloning the git repository to your file system you can build the SDK artifact from source to the build
directory by running ./gradlew build
on *nix systems or gradlew.bat
on Windows systems.
If you wish to build from source and publish the SDK artifact to your local Maven repository (on your filesystem) then use the following command (after cloning the git repo locally):
On *nix:
./gradlew publishToMavenLocal -Pskip.signing
On Windows:
gradlew.bat publishToMavenLocal -Pskip.signing
A logging framework/facade has not yet been adopted but is under consideration.
For request and response logging (especially json bodies) use:
SpeakeasyHTTPClient.setDebugLogging(true); // experimental API only (may change without warning)
Example output:
Sending request: http://localhost:35123/bearer#global GET
Request headers: {Accept=[application/json], Authorization=[******], Client-Level-Header=[added by client], Idempotency-Key=[some-key], x-speakeasy-user-agent=[speakeasy-sdk/java 0.0.1 internal 0.1.0 org.openapis.openapi]}
Received response: (GET http://localhost:35123/bearer#global) 200
Response headers: {access-control-allow-credentials=[true], access-control-allow-origin=[*], connection=[keep-alive], content-length=[50], content-type=[application/json], date=[Wed, 09 Apr 2025 01:43:29 GMT], server=[gunicorn/19.9.0]}
Response body:
{
"authenticated": true,
"token": "global"
}
WARNING: This should only used for temporary debugging purposes. Leaving this option on in a production system could expose credentials/secrets in logs. Authorization headers are redacted by default and there is the ability to specify redacted header names via SpeakeasyHTTPClient.setRedactedHeaders
.
Another option is to set the System property -Djdk.httpclient.HttpClient.log=all
. However, this second option does not log bodies.
package hello.world;
import com.airbyte.api.Airbyte;
import com.airbyte.api.models.operations.CreateConnectionResponse;
import com.airbyte.api.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Airbyte sdk = Airbyte.builder()
.security(Security.builder()
.basicAuth(SchemeBasicAuth.builder()
.password("")
.username("")
.build())
.build())
.build();
ConnectionCreateRequest req = ConnectionCreateRequest.builder()
.destinationId("e478de0d-a3a0-475c-b019-25f7dd29e281")
.sourceId("95e66a59-8045-4307-9678-63bc3c9b8c93")
.name("Postgres-to-Bigquery")
.build();
CreateConnectionResponse res = sdk.connections().createConnection()
.request(req)
.call();
if (res.connectionResponse().isPresent()) {
// handle response
}
}
}
This SDK supports the following security schemes globally:
Name | Type | Scheme |
---|---|---|
basicAuth |
http | HTTP Basic |
bearerAuth |
http | HTTP Bearer |
clientCredentials |
oauth2 | OAuth2 token |
You can set the security parameters through the security
builder method when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:
package hello.world;
import com.airbyte.api.Airbyte;
import com.airbyte.api.models.operations.CreateConnectionResponse;
import com.airbyte.api.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Airbyte sdk = Airbyte.builder()
.security(Security.builder()
.basicAuth(SchemeBasicAuth.builder()
.password("")
.username("")
.build())
.build())
.build();
ConnectionCreateRequest req = ConnectionCreateRequest.builder()
.destinationId("e478de0d-a3a0-475c-b019-25f7dd29e281")
.sourceId("95e66a59-8045-4307-9678-63bc3c9b8c93")
.name("Postgres-to-Bigquery")
.build();
CreateConnectionResponse res = sdk.connections().createConnection()
.request(req)
.call();
if (res.connectionResponse().isPresent()) {
// handle response
}
}
}
Available methods
- createConnection - Create a connection
- deleteConnection - Delete a Connection
- getConnection - Get Connection details
- listConnections - List connections
- patchConnection - Update Connection details
- createDeclarativeSourceDefinition - Create a declarative source definition.
- deleteDeclarativeSourceDefinition - Delete a declarative source definition.
- getDeclarativeSourceDefinition - Get declarative source definition details.
- listDeclarativeSourceDefinitions - List declarative source definitions.
- updateDeclarativeSourceDefinition - Update declarative source definition details.
- createDestinationDefinition - Create a destination definition.
- deleteDestinationDefinition - Delete a destination definition.
- getDestinationDefinition - Get destination definition details.
- listDestinationDefinitions - List destination definitions.
- updateDestinationDefinition - Update destination definition details.
- createDestination - Create a destination
- deleteDestination - Delete a Destination
- getDestination - Get Destination details
- listDestinations - List destinations
- patchDestination - Update a Destination
- putDestination - Update a Destination and fully overwrite it
- getHealthCheck - Health Check
- cancelJob - Cancel a running Job
- createJob - Trigger a sync or reset job of a connection
- getJob - Get Job status and details
- listJobs - List Jobs by sync type
- listOrganizationsForUser - List all organizations for a user
- createPermission - Create a permission
- deletePermission - Delete a Permission
- getPermission - Get Permission details
- listPermissions - List Permissions by user id
- updatePermission - Update a permission
- createSourceDefinition - Create a source definition.
- deleteSourceDefinition - Delete a source definition.
- getSourceDefinition - Get source definition details.
- listSourceDefinitions - List source definitions.
- updateSourceDefinition - Update source definition details.
- createSource - Create a source
- deleteSource - Delete a Source
- getSource - Get Source details
- initiateOAuth - Initiate OAuth for a source
- listSources - List sources
- patchSource - Update a Source
- putSource - Update a Source and fully overwrite it
- getStreamProperties - Get stream properties
- createTag - Create a tag
- deleteTag - Delete a tag
- getTag - Get a tag
- listTags - List all tags
- updateTag - Update a tag
- listUsersWithinAnOrganization - List all users within an organization
- createOrUpdateWorkspaceOAuthCredentials - Create OAuth override credentials for a workspace and source type.
- createWorkspace - Create a workspace
- deleteWorkspace - Delete a Workspace
- getWorkspace - Get Workspace details
- listWorkspaces - List workspaces
- updateWorkspace - Update a workspace
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
By default, an API error will throw a models/errors/SDKError
exception. When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the createConnection
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4XX, 5XX | */* |
package hello.world;
import com.airbyte.api.Airbyte;
import com.airbyte.api.models.operations.CreateConnectionResponse;
import com.airbyte.api.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Airbyte sdk = Airbyte.builder()
.security(Security.builder()
.basicAuth(SchemeBasicAuth.builder()
.password("")
.username("")
.build())
.build())
.build();
ConnectionCreateRequest req = ConnectionCreateRequest.builder()
.destinationId("e478de0d-a3a0-475c-b019-25f7dd29e281")
.sourceId("95e66a59-8045-4307-9678-63bc3c9b8c93")
.name("Postgres-to-Bigquery")
.build();
CreateConnectionResponse res = sdk.connections().createConnection()
.request(req)
.call();
if (res.connectionResponse().isPresent()) {
// handle response
}
}
}
The default server can be overridden globally using the .serverURL(String serverUrl)
builder method when initializing the SDK client instance. For example:
package hello.world;
import com.airbyte.api.Airbyte;
import com.airbyte.api.models.operations.CreateConnectionResponse;
import com.airbyte.api.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Airbyte sdk = Airbyte.builder()
.serverURL("https://api.airbyte.com/v1")
.security(Security.builder()
.basicAuth(SchemeBasicAuth.builder()
.password("")
.username("")
.build())
.build())
.build();
ConnectionCreateRequest req = ConnectionCreateRequest.builder()
.destinationId("e478de0d-a3a0-475c-b019-25f7dd29e281")
.sourceId("95e66a59-8045-4307-9678-63bc3c9b8c93")
.name("Postgres-to-Bigquery")
.build();
CreateConnectionResponse res = sdk.connections().createConnection()
.request(req)
.call();
if (res.connectionResponse().isPresent()) {
// handle response
}
}
}
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.