> ## Documentation Index
> Fetch the complete documentation index at: https://docs.methodfi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Connect

export const ConnectExpandQueryParam = () => {
  const fields = [{
    name: 'accounts',
    description: <>Expand the full <a href="/reference/accounts/overview">Account</a> object(s) returned in the response.</>
  }, {
    name: 'accounts.balance',
    description: <>Expand the <a href="/reference/accounts/balances/overview#balances-objects">Balance</a> object on the Account.</>
  }, {
    name: 'accounts.card_brand',
    description: <>Expand the <a href="/reference/accounts/card-brands/overview#cardbrand-objects">CardBrand</a> object on the Account.</>
  }, {
    name: 'accounts.attribute',
    description: <>Expand the <a href="/reference/accounts/attributes/overview#attribute-objects">Attribute</a> object on the Account.</>
  }, {
    name: 'accounts.update',
    description: <>Expand the <a href="/reference/accounts/updates/overview#update-objects">Update</a> object on the Account.</>
  }, {
    name: 'accounts.payment_instrument',
    description: <>Expand the <a href="/reference/accounts/payment-instruments/overview#paymentinstrument-objects">PaymentInstrument</a> object on the Account.</>
  }, {
    name: 'accounts.latest_verification_session',
    description: <>Expand the <a href="/reference/accounts/verification-sessions/overview#accountverificationsession-objects">AccountVerificationSession</a> object on the Account.</>
  }];
  return {
    name: 'expand',
    type: 'enum[]',
    description: <>
        Optional fields to expand in the response. You can expand the full <code>accounts</code> object on its own, or expand specific subfields like <code>accounts.balance</code>.
        If a subfield is requested, the parent <code>accounts</code> object will also be expanded automatically.
      </>,
    enums: fields
  };
};

export const ProductsAndSubscriptionsQueryParams = () => {
  const products = [{
    name: 'attribute',
    description: <>Execute the <a href="/reference/accounts/attributes/overview#attribute-objects">Attribute</a> product on connected accounts.</>
  }, {
    name: 'balance',
    description: <>Execute the <a href="/reference/accounts/balances/overview#balances-objects">Balance</a> product on connected accounts.</>
  }, {
    name: 'update',
    description: <>Execute the <a href="/reference/accounts/updates/overview#update-objects">Update</a> product on connected accounts.</>
  }, {
    name: 'card_brand',
    description: <>Execute the <a href="/reference/accounts/card-brands/overview#cardbrand-objects">CardBrand</a> product on connected accounts.</>
  }, {
    name: 'payoff',
    description: <>Execute the <a href="/reference/accounts/payoffs/overview#payoff-objects">Payoff</a> product on connected accounts.</>
  }];
  const subscriptions = [{
    name: 'card_brand',
    description: <>Subscribe to <a href="/reference/accounts/card-brands/overview#cardbrand-objects">CardBrand</a> updates.</>
  }, {
    name: 'update',
    description: <>Subscribe to <a href="/reference/accounts/updates/overview#update-objects">Update</a> events.</>
  }, {
    name: 'update.snapshot',
    description: <>Subscribe to <a href="/reference/accounts/updates/overview#update-objects">Update Snapshot</a> events.</>
  }, {
    name: 'transaction',
    description: <>Subscribe to <a href="/reference/accounts/transactions/overview#transaction-objects">Transaction</a> events.</>
  }];
  return {
    products: {
      name: 'products',
      type: 'enum[]',
      description: <>The account products to execute on all accounts retrieved from this connect request.</>,
      enums: products.map(p => ({
        ...p
      }))
    },
    subscriptions: {
      name: 'subscriptions',
      type: 'enum[]',
      description: <>The account subscriptions to automatically set up on all accounts retrieved from this connect request.</>,
      enums: subscriptions.map(s => ({
        ...s
      }))
    }
  };
};

export const connect_name = "Connect";

export const ParamList = ({items = [], is_child = false}) => {
  return items.map(item => {
    const field_props = {
      id: Math.random().toString(),
      body: item.name,
      name: item.name,
      type: item.type,
      required: item.required
    };
    const enums = item.enums || [];
    const items = item.items || [];
    const has_items = items?.length > 0;
    const has_enums = enums?.length > 0;
    const should_default_open = item.defaultOpen || false;
    const render_child_item = () => {
      const child_props = {
        title: has_enums ? "Possible enum values" : "properties"
      };
      if (should_default_open) child_props.defaultOpen = true;
      const has_inline_enums = has_enums && enums.every(enum_item => typeof enum_item === 'string') && enums.map((enum_item, idx) => {
        const is_last = idx === enums.length - 1;
        const is_2nd_to_last = idx === enums.length - 2;
        return <>
            <code>{enum_item}</code>
            {is_last && ''}
            {is_2nd_to_last && ' or '}
            {!is_last && !is_2nd_to_last && ', '}
          </>;
      });
      const enum_list = has_enums && !has_inline_enums && <Accordion {...child_props}>
          {enums.map((enum_item, index) => <div key={`enum-${index}`}>
              <code>{enum_item.name}</code>
              <br />
              <p>{enum_item.description}</p>
            </div>)}
        </Accordion>;
      const item_list = has_items && <Expandable {...child_props}>
          <ParamList items={items || []} is_child />
        </Expandable>;
      return <>
          <p>
            {item.description}
            {has_inline_enums && [has_inline_enums.length > 1 ? ' One of ' : ' Must be ', ...has_inline_enums]}
          </p>

          {enum_list}
          {item_list}
        </>;
    };
    return is_child ? <ResponseField {...field_props}>{render_child_item()}</ResponseField> : <ParamField {...field_props}>{render_child_item()}</ParamField>;
  });
};

Creates a new Connect request to connect all liability accounts for the Entity.

Operation Type: <Tooltip tip="Your request is processed immediately, and you'll receive a response before proceeding. Webhooks will be fired in parallel.">⚡ Synchronous</Tooltip> or <Tooltip tip="Your request is processed in the background. You'll receive a webhook when it's complete.">Asynchronous  ⏳</Tooltip>

<Warning>
  Your request is processed asynchronously if `Prefer: respond-async` header is set or if products / subscriptions are specified. You'll receive a webhook when it's complete.
</Warning>

<Tip>An initial Connect request will connect all liability accounts (closed and active),
all subsequent Connect requests will only return new accounts for an Entity.</Tip>

## Path Parameters

<ParamList
  items={[
{
  name: "ent_id",
  type: "string",
  required: true,
  description: `The ID of the Entity.`,
},
]}
/>

## Query Parameters

{(() => {
const { name, type, description, enums } = ConnectExpandQueryParam();
return (
  <ParamList
    items={[
      { name, type, description, enums },
    ]}
  />
);
})()}

## Body

{(() => {
const { products, subscriptions } = ProductsAndSubscriptionsQueryParams();
return (
  <ParamList
    items={[
      products,
      subscriptions,
    ]}
  />
);
})()}

## Returns

Returns a {connect_name} object.

<RequestExample>
  ```bash cURL theme={null}
  curl https://production.methodfi.com/entities/ent_qKNBB68bfHGNA/connect \
    -X POST \
    -H "Method-Version: 2026-03-30" \
    -H "Authorization: Bearer sk_WyZEWVfTcH7GqmPzUPk65Vjc"
  ```

  ```javascript Node.js theme={null}
  const entity = await method
    .entities("ent_qKNBB68bfHGNA")
    .connect
    .create();
  ```

  ```python Python theme={null}
  entity = method
    .entities('ent_qKNBB68bfHGNA')
    .connect
    .create()
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "id": "cxn_4ewMmBbjYDMR4",
    "entity_id": "ent_qKNBB68bfHGNA",
    "status": "completed",
    "accounts": [
      "acc_eKKmrXDpJBKgw",
      "acc_GV8WbmJW7KGRy",
      "acc_MLPKh9gQDDbT8",
      "acc_LbXE8wVYJLrKt",
      "acc_J3P9fayDFjpAy",
      "acc_eFFRV9zmpLREK"
    ],
    "requested_products": [],
    "requested_subscriptions": [],
    "error": null,
    "created_at": "2024-04-12T14:56:46.645Z",
    "updated_at": "2024-04-12T14:56:46.645Z"
  }
  ```
</ResponseExample>
