external_id field on connections lets you associate a Deck resource with an identifier from your own system. This is the primary mechanism for mapping Deck connections to your users, accounts, or tenants.
How it works
When you create a connection, pass anexternal_id to link it to a record in your system:
external_id is stored on the connection and returned in all API responses and event payloads for that connection.
Constraints
- Maximum length: 255 characters
- Must be a string
- Can be
null(no external mapping) - Not required to be unique across connections, but in most cases you’ll want it to be meaningful
Multi-tenant patterns
If you’re building a platform where multiple end users connect to the same source,external_id is how you keep track of which connection belongs to which user.
- One user, one connection
- One user, multiple connections
- Organizational mapping
The simplest pattern. Each user in your system has a single connection per source. Use your internal user ID as the To find a user’s connection later:
external_id.Updating an external ID
You can update theexternal_id on an existing connection:
null to remove the mapping:
External IDs in events
When a connection triggers an event (e.g.,task_run.completed), the event payload includes the connection’s external_id. This lets you route event processing to the right user in your system without an extra API call.
GET /v2/connections/{connection_id}.
Best practices
- Set
external_idat creation time. It’s easier to set it upfront than to backfill later. - Use stable identifiers. Choose IDs that won’t change, like your database primary key or a UUID. Avoid using emails or usernames that users can modify.
- Keep it consistent. Use the same
external_idformat across all connections for a given user. If you useuser_12345for one source, use it for all sources. - Use it for filtering. The list connections endpoint supports filtering by
external_id, making it easy to find all connections for a specific user. You can also search byexternal_idin the Dashboard.
