> ## 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 or Update Session

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>;
  });
};

Creating or updating an Element Session is as simple as creating an Element Token with a supported Session `type`

## Body

<ParamList
  items={[
{
  name: "type",
  type: "enum",
  description: "The type of session to start.",
  required: true,
  enums: ["balance_transfer"]
},
{
  name: "entity_id",
  type: "string",
  description: "The ID of the associated Entity.",
  required: true
},
{
  name: 'balance_transfer',
  type: 'object, null',
  required: false,
  description: 'The balance transfer object to be processed.',
},
{
  name: 'element_session_id',
  type: 'string',
  description: 'The ID of the Element Session to update. Required for updating a session. If not provided, a new session will be created.',
  required: false
}
]}
/>

## Additional fields based on session type

<Tabs>
  <Tab title="balance_transfer">
    <ParamList
      items={[
    {
      name: "balance_transfer",
      type: "object, null",
      defaultOpen: true,
      description: "The balance transfer object to be processed.",
      items: [
        { name: "balance_transfer.flow_type", type: "string", description: "The type of flow to start."},
        { name: "balance_transfer.payout_amount_min", type: "number", description: "The minimum amount that has be paid out." },
        { name: "balance_transfer.minimum_loan_amount", type: "number", description: "The minimum amount that can be loaned." },
        { name: "balance_transfer.payout_residual_amount_max", type: "number", description: "The maximum amount that can be paid out." },
        { name: "balance_transfer.loan_details_requested_amount", type: "number", description: "The amount requested for the loan." },
        { name: "balance_transfer.loan_details_requested_term", type: "number", description: "The term requested for the loan." },
        { name: "balance_transfer.loan_details_requested_rate", type: "number", description: "The rate requested for the loan." },
        { name: "balance_transfer.loan_details_requested_monthly_payment", type: "number", description: "The monthly payment requested for the loan." },
      ]
    }
  ]}
    />
  </Tab>
</Tabs>

## Returns

Returns a Session object.

<RequestExample>
  ```bash cURL theme={null}
  curl https://production.methodfi.com/elements/token \
    -X POST \
    -H "Method-Version: 2026-03-30" \
    -H "Authorization: Bearer sk_WyZEWVfTcH7GqmPzUPk65Vjc" \
    -H "Content-Type: application/json" \
    -d '{
      "type": "balance_transfer",
      "entity_id": "ent_4t8ycqn435",
      "balance_transfer": {
        ...
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "element_token": "pk_elem_qEqwrYEUELA6ExqfB4y8jjmpN8yBb38M",
      "element_session_id": "elem_sess_dYJpqRhKNzaqw"
      },
    "message": null
  }
  ```
</ResponseExample>
