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

# Linking bank accounts

> Learn how to generate an external authentication link for a company’s mobile number using the SynchPay API.

## Overview

The `/company/{companyReferenceId}/externalauthlink` endpoint allows you to generate a one-time URL that you can use to link bank accounts.

## How It Works

<Steps>
  <Step title="Obtain an Access Token">
    First, request an access token by calling the `/auth/token` endpoint with your `ClientId` and `ClientSecret`.
  </Step>

  <Step title="Prepare the Company Reference">
    Identify the target company by its `companyReferenceId`—this can be either a GUID (`CompanyId`) or a custom reference string.
  </Step>

  <Step title="Submit the Mobile Number">
    Provide the customer’s `MobileNumber` (in E.164 format) in the request body.
  </Step>

  <Step title="Receive the Auth Link">
    On success, the API returns a complete `ExternalAuthLinkUrl` that you can use to link accounts.
  </Step>
</Steps>

### Endpoint

* **URL**:\
  `https://api.synchpay.com/company/{companyReferenceId}/externalauthlink`
* **Method**: `POST`
* **Authorization**: `Bearer <AccessToken>`\
  *Note*: Acquire your access token from `/auth/token` using your `ClientId` and `ClientSecret`.

### Path Parameter

| Parameter            | Type   | Description                                                                                 | Required |
| -------------------- | ------ | ------------------------------------------------------------------------------------------- | -------- |
| `companyReferenceId` | string | The company’s unique identifier—either its GUID (`CompanyId`) or a custom reference string. | Yes      |

### Request Body

The JSON payload must include:

| Parameter      | Type   | Description                                                     | Required |
| -------------- | ------ | --------------------------------------------------------------- | -------- |
| `MobileNumber` | string | Customer’s mobile number in E.164 format (e.g. "+15551234567"). | Yes      |

#### Example Request

```json theme={null}
{
  "MobileNumber": "+15551234567"
}
```

## Response

On success, you’ll receive the following response model:

### Response Properties

| Property              | Type   | Description                                              |
| :-------------------- | :----- | :------------------------------------------------------- |
| `externalAuthLinkUrl` | string | A fully-formed URL that allow for linking bank accounts. |

#### Example Response

```json theme={null}
{
      "externalAuthLinkUrl": "https://app.trysynch.com/ExternalAuth?token=ea123456-7890-abcdef-1234-567890abcdef"
}
```
