Integration Contract

Define a valid manifest, connect each capability and action to a real hook, and return safe authentication, sync, and fulfillment results.

On this page

The registry fails fast on an invalid manifest

Valid manifest for a disabled ticket adapter; matching hooks are required
const manifest = {
  key: 'acme-tickets',
  version: '1.0.0',
  provider: { name: 'tickets.acme.example' },
  displayName: 'Acme Tickets',
  description: 'Import events and fulfill ticket purchases.',
  capabilities: [
    'account', 'groups', 'events', 'ticket_inventory',
    'ticket_fulfillment', 'manual_sync', 'scheduled_sync',
  ],
  fulfillment: { retrySafety: 'manual_reconciliation' },
  auth: {
    methods: [{
      key: 'token',
      label: 'Access token',
      flow: 'token',
      fields: [{
        name: 'token', label: 'Access token', type: 'token', required: true,
      }],
    }],
  },
  catalog: { authType: 'token', enabledByDefault: false },
  actions: { refresh: true, configure: false, disconnect: true },
};
Required integration manifest fields
FieldRequirement
keyUnique lowercase kebab-case registry key used in code paths and URLs.
versionSemantic version describing the adapter contract.
provider.nameStable non-empty name used to resolve the existing Provider catalog row.
displayNameUser-facing provider name.
descriptionSafe user-facing purpose; do not expose operational details or credentials.
capabilitiesUnique supported values that exactly match implemented hooks.
auth.methodsAt least one valid direct, token, challenge, or OAuth method.

Capabilities declare dependencies; actions declare controls

Capabilities and required adapter hooks
DeclarationContract
accountgetAccount is mandatory for every connection.
groupslistGroups; use a stable synthetic group only when the provider has none.
eventsgroups plus listEvents.
ticket_inventorylistEvents embeds canonical ticket classes, prices, currency, and availability on each event.
ticket_fulfillmentfulfillOrder with durable idempotency and reconciliation behavior.
credential_refreshrefreshCredential and refreshable credential metadata.
manual_syncAllows an authenticated account refresh through the common sync service.
scheduled_syncEnrolls the adapter in the shared bounded scheduler; no provider-specific cron is required.

Optional actions control the operator interface. Refresh must befalse unless manual_sync is declared. Configure must befalse unless a real configure() hook exists. Disconnect can expose the common owner-scoped operation and an optional provider revocation hook. A missing action means unavailable behavior, not a placeholder button.

  • Use actions.refresh: true only for the common manual-sync path.
  • Use actions.configure: true only when configuration can be validated and applied through the adapter hook.
  • Use actions.disconnect: true to expose credential clearing and imported-resource deactivation; upstream revocation runs only when the adapter implements its optional disconnect hook, and historical records remain retained.
  • Use sync.resourceConcurrency for bounded persistence tuning; the platform clamps it to 10.

Choose one of four authentication flows

Supported authentication flows
FlowTypical useRequired hooks
directEmail/password or another one-step login.authenticate
tokenA user-supplied or internal access token.authenticate
challengePhone or email verification code.beginAuth and completeAuth
oauthRedirect or authorization challenge.beginAuth and completeAuth

Auth method keys use snake_case. Supported field types are email,password, tel, text, token, andurl, with optional required, minimum-length, pattern, and safe validation message metadata. Authentication hooks also receive the resolved Provider record so they can read protected application configuration.

  1. Start securely

    Validate the method and fields, then let the platform sign short-lived opaque auth state bound to the provider, method, owner, acting user, team account, fields, and upstream challenge.

  2. Echo state unchanged

    The client returns the opaque auth_state. It cannot replace the original subject or fields during completion.

  3. Return a credential envelope

    Return a required access token and optional expiry and refresh token, plus an optional canonical account and safe metadata.

  4. Refresh only when declared

    A credential-refresh adapter returns the same envelope shape from refreshCredential and distinguishes invalid credentials from transient provider failures.

Errors are typed, safe, and operationally useful

  • Use a stable code, a safe public message, an appropriate status, and retryable only when repetition is safe.
  • Never attach passwords, tokens, codes, cookies, authorization headers, full provider responses, signed URLs, or private buyer data to errors or raw logs.
  • Treat every auth field, challenge, provider payload, webhook, and payment field as untrusted input.
  • Scope all work to the platform-supplied user and resolved Provider; never trust ownership IDs returned by the provider or sent by a client.
  • Apply application and edge/shared-store throttling to password, token, and verification-code attempts.
  • Confirm the provider permits every official and private/organizer workflow before shipping it.

All clients use the common integration service

Common authenticated integration operations
OperationBehavior
Authenticated catalog and manifestReturn provider presentation with explicit enabled and connection state while removing internal methods and Provider.config.
Anonymous app catalogGET /integrations/public and /integrations/public/:provider return only enabled Provider identity, reviewed app metadata, public manifest fields, and the sanitized checkout_fee projection.
Start and complete authenticationValidate manifest fields, throttle attempts, bind signed state, persist credentials, fetch the canonical account, and run initial sync.
Manual account syncVerify ownership of the Provider_Account, invoke the same adapter/persistence path, and return success, partial, or failed counts.
DisconnectAttempt optional provider revocation, clear stored credentials, advance the connection generation, stop scheduled selection, hide groups, and mark imports unavailable while retaining history.
Scheduled sync and refreshLease eligible accounts through shared bounded queues and dispatch only capabilities declared by the resolved Provider integration.
FulfillmentEnter through the integration service with the same purchase idempotency key; never call the adapter directly from payment, webhook, retry, or recovery code.

Next guide

Testing & Release
Ticket Integration Contract | Diem Developer Documentation