Skip to main content
The Java SDK is the com.sendflit:sendflit artifact. It uses the JDK’s built-in HttpClient and has no third-party dependencies. It requires Java 17 or later.
Looking for another language? See the SDK overview.

Install

Maven:
Gradle:

Create a client

Use the builder. Read your key from the environment.
The builder accepts these options:

Send an email

Build an Email with its builder, then pass it to send. send returns a SendResult.
Builder methods:

Attachments

Use attach. It takes the file’s bytes and base64-encodes them for you.
Limits:
  • Up to 10 attachments per message.
  • Up to 10 MB per attachment. Larger files are rejected with 422.

Send a batch

batch sends up to 100 emails in one request and returns a List<SendResult> in the same order as your input.
An empty list, or more than 100 emails, throws IllegalArgumentException before any request is made. See Batch sending.
The Java SDK doesn’t send an Idempotency-Key header yet, so a retried send can deliver twice. Check the earlier result before you retry. See Idempotency.

Manage emails

The Java SDK can list emails. It doesn’t have methods to get or cancel a single email yet. Use GET /v1/emails/{id} or DELETE /v1/emails/{id} directly if you need them.

Domains

You can send only from a verified domain. For DNS setup, see Domains.

Suppressions

See Emails.

Usage

The Java SDK doesn’t have a health method yet. Call GET /health directly if you need one.

Verify webhooks

SendFlit signs each webhook. The X-Sendflit-Signature header carries sha256=<hex>, an HMAC-SHA256 of the raw request body. Pass the raw bytes to the static method.
The comparison runs in constant time. See Webhooks for the event list.

Errors and retries

Failed calls throw SendFlit.SendFlitException, a checked exception. It has two public fields:
Requests that fail with 429 or 5xx are retried up to maxRetries times. The SDK honors the Retry-After header when it’s present. Other 4xx responses are not retried. See Errors, retries and limits.

Method reference

Next steps