Skip to main content
A connection represents one set of credentials authenticated to one source. If a user needs access to Hilton and Marriott, that’s two connections. Use external_id when creating connections to tie multiple connections back to the same user in your system, so you can query all of a user’s connections without maintaining a separate mapping.

How connections fit in

A connection sits between a source and a task run. It gives the task run an authenticated browser session to work with. Once the connection status is connected, you can run any of the source’s associated tasks against it.

Opening a connection

Pass credentials through the API, and Deck authenticates the user in the background. The API responds immediately with connecting status while authentication proceeds asynchronously. Listen for connection.connected or connection.interaction_required events to know when the connection is ready, or poll GET /v2/connections/{connection_id} until the status changes.
POST /v2/connections

{
  "source_id": "src_a1b2c3d4...",
  "auth_method": "username_password",
  "auth_credentials": {
    "username": "user@example.com",
    "password": "..."
  },
  "external_id": "user_123"
}

Auth methods

MethodDescription
username_passwordStandard username and password
google_ssoGoogle single sign-on
noneNo credentials needed (public sources)

Connection statuses

StatusMeaning
connectingDeck is authenticating the user (async, transitions automatically)
connectedSession is active and ready for task execution
interaction_requiredThe source is asking for verification (MFA, security question)
invalidThe credentials were rejected by the source
disconnectedThe browser session was closed
terminatedYou closed the connection and credentials were permanently deleted
A connection becomes invalid when the source rejects the provided credentials. This can happen on the initial login attempt or when previously valid credentials expire or are changed on the source. An invalid connection cannot run tasks. To retry, create a new connection with updated credentials. Connections become disconnected after a period of inactivity or if the session drops. A disconnected connection can’t run tasks, but you can reopen it using the same connection ID. A terminated connection is permanent. When you terminate a connection, Deck deletes the credentials from the vault and can no longer authenticate on behalf of that user. The connection object and its task runs are still queryable, but no new tasks can be executed.

Interactions

When a source requires MFA or other verification, the connection pauses with interaction_required status. Collect the input from your user and submit it to resume. See Handling interactions for details.

Terminating a connection

POST /v2/connections/{connection_id}/disconnect
Terminating a connection ends the browser session. The connection becomes read-only: you can still query it and its task runs, but no new work can be executed against it. If the user needs to perform more work on that source, create a new connection.

Deep dives