Docs/Admin API/Users/Connect

Connect external account

POST/admin/v1/users/{userId}:connect

Connect specified user to external account.

path parameters

  • userId

    string

    Required

    The user identifier.

body parameters

  • connectionId

    string

    Required

    The identifier of the connection.

  • externalId

    string

    The external identifier of the user to connect.

    On create if this is empty a new external user will be created if the connection supports it.

Returns

  • id

    string

    The system-assigned identifier of the user.

  • state

    enum

    The current state of the user.

    Possible values:
    ACTIVEDISABLEDARCHIVEDPENDING_DELETION
  • stateReason

    string

    The code that best describes the reason for the state.

  • uniqueId

    string

    The client defined unique identifier of the user account.

  • displayName

    string

    The human-readable display name of the user.

  • email

    string

    The email address of the user.

  • emailVerified

    boolean

    Whether the user's email address has been verified.

  • phoneNumber

    string

    The E164 phone number for the user (e.g. +12125550123).

  • phoneNumberVerified

    boolean

    Whether the user's phone number has been verified.

  • imageUrl

    string

    The photo/avatar URL of the user.

  • currencyCode

    string

    The default ISO-4217 currency code for the user (e.g. USD).

  • languageCode

    string

    The IETF BCP-47 language code for the user (e.g. en).

  • regionCode

    string

    The country/region code for the user (e.g. US).

  • timeZone

    string

    The IANA time zone for the user (e.g. America/New_York).

  • address

    Address

    The default address for the user.

  • accountConnections

    AccountConnection[]

    The connected accounts.

  • subscription

    AccountSubscription

    The user's default active individual subscription.

    See memberships for organization subscription and seat information.

  • memberships

    Membership[]

    The user's organization memberships.

  • signupTime

    date-time

    The sign-up time for the user.

  • disabled

    boolean

    Whether the user is disabled.

  • createTime

    date-time

    The creation time of the user.

  • updateTime

    date-time

    The last update time of the user.

curl https://api.userhub.com/admin/v1/users/usr_MKFxzgJaAH8JQ4:connect \
  -H "Authorization: Bearer $USERHUB_ADMIN_KEY" \
  --json '{
    "connectionId": "conn_4HdRKnTvPmmjYK",
    "externalId": "cus_Fn7PABWZFFso"
  }'
Response bodyJSON
{
  "id": "usr_MKFxzgJaAH8JQ4",
  "state": "ACTIVE",
  "displayName": "Jane Doe",
  "email": "[email protected]",
  "emailVerified": true,
  "phoneNumber": "+12125550123",
  "phoneNumberVerified": false,
  "imageUrl": "https://example.com/jane.jpg",
  "currencyCode": "USD",
  "languageCode": "en",
  "regionCode": "US",
  "timeZone": "America/New_York",
  "address": {
    "lines": [
      "42 West St"
    ],
    "city": "Brooklyn",
    "state": "NY",
    "postalCode": "11222",
    "country": "US"
  },
  "accountConnections": [
    {
      "connection": {
        "id": "conn_4HdRKnTvPmmjYK",
        "displayName": "Stripe",
        "state": "ACTIVE",
        "type": "STRIPE",
        "delegate": null,
        "providers": [],
        "createTime": "2024-11-15T13:00:00Z",
        "updateTime": "2024-11-15T13:00:00Z"
      },
      "externalId": "cus_Fn7PABWZFFso",
      "adminUrl": "https://dashboard.stripe.com/test/customers/cus_Fn7PABWZFFso",
      "state": "ACTIVE",
      "currencyCode": "USD",
      "balanceAmount": "0",
      "paymentMethods": [],
      "pullTime": "2024-11-15T13:00:00Z",
      "pushTime": null,
      "createTime": "2024-11-15T13:00:00Z",
      "updateTime": "2024-11-15T13:00:00Z"
    }
  ],
  "subscription": null,
  "memberships": [],
  "signupTime": "2024-11-15T13:00:00Z",
  "createTime": "2024-11-15T13:00:00Z",
  "updateTime": "2024-11-15T13:00:00Z"
}
PreviousHard delete a user
NextDisconnect external account

Build software thatmonetizes
$

Subscribe to monthly product updates

© 2025 UserHub

Integrations

    UserHub & Auth0UserHub & Stripe BillingUserHub & Google CloudUserHub & FirebaseUserHub & custom auth