SignatureKit

Clicksign

Create Clicksign v1 document requests with Redacted credentials and typed SignatureKit errors.

Clicksign creates the upstream document and signer, optionally notifies the recipient, then returns a Clicksign-owned ClicksignSignatureRequestAttributes record. It is not a local Signatures backend and it does not mutate PDF bytes in-process.

Installation

@signature-kit/http @signature-kit/clicksign

When to use

Use Clicksign when the signing ceremony, reminders, and audit trail live in Clicksign. Use local A1/PDF signing when your app must produce signed bytes directly.

Minimal request

title="clicksign.ts"

import * as Alchemy from "alchemy"
import { ClicksignSignatureRequest, providers as clicksignProviders } from "@signature-kit/clicksign"
import { signatureHttpClientLive } from "@signature-kit/http"
import { Effect, Layer, Redacted } from "effect"

export default class Contracts extends Alchemy.Stack<Contracts>()(
  "Contracts",
  {
    providers: Layer.merge(
      clicksignProviders({
        accessToken: Redacted.make(process.env.CLICKSIGN_TOKEN ?? ""),
        environment: "sandbox",
        locale: "pt-BR",
        autoClose: true,
      }),
      signatureHttpClientLive,
    ),
    state: Alchemy.inMemoryState(),
  },
  Effect.gen(function* () {
    return yield* ClicksignSignatureRequest("service-agreement", {
      title: "Service agreement",
      message: "Review and sign this document.",
      documents: [{ fileName: "contract.pdf", mimeType: "application/pdf", contentBase64: pdfBase64 }],
      recipients: [{ name: "Ada Lovelace", email: "ada@example.com", role: "signer" }],
      send: true,
    })
  }),
) {}

Provider facts

  • v1 flow creates a document, signer, and optional notification.

  • One document per request; the props schema is a single-document tuple, so passing more than one document fails at schema decode time as signature-kit.INVALID_INPUT.

  • The access token is unwrapped only inside the package HTTP boundary.

Errors

Invalid input, remote HTTP failures, and invalid response shapes fail as SignatureKitError. The provider, operation, and HTTP status fields are preserved when the upstream response exposes them.

Wait for a final state

waitForClicksignSignatureRequest(options, id, pollInterval) reads immediately and polls while the request is draft or sent. It returns the provider's final state, including cancellation, rejection, deletion, or expiry; inspect state before downloading. The interval must be positive and finite. Read failures propagate immediately without automatic retry. Interruption cancels the active read and stops future polls. The caller owns the deadline:

import { waitForClicksignSignatureRequest } from "@signature-kit/clicksign";
import { signatureHttpClientLive } from "@signature-kit/http";
import { Duration, Effect } from "effect";
import type { ClicksignProviderOptions } from "@signature-kit/clicksign";

declare const options: ClicksignProviderOptions;
declare const requestId: string;

const program = waitForClicksignSignatureRequest(options, requestId, Duration.seconds(2)).pipe(
  Effect.timeout(Duration.minutes(5)),
  Effect.provide(signatureHttpClientLive),
);

How is this guide?