> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Linked Accounts

The auth identities linked to a user: list and inspect, link social, unlink.

## Link social account

`POST /iam/v2/auth/link-social`

Link a social account to the user

### Request body (required) (`application/json`)

- `callbackURL` `string | null`: The URL to redirect to after the user has signed in
- `provider` `string` _(required)_
- `idToken` `object | null`
  - `token` `string` _(required)_
  - `nonce` `string | null`
  - `accessToken` `string | null`
  - `refreshToken` `string | null`
  - `scopes` `array | null`
- `requestSignUp` `boolean | null`
- `scopes` `array | null`: Additional scopes to request from the provider
- `errorCallbackURL` `string | null`: The URL to redirect to if there is an error during the link process
- `disableRedirect` `boolean | null`: Disable automatic redirection to the provider. Useful for handling the redirection yourself

### Responses

#### `200`: Success

Body (`application/json`):

- `url` `string`: The authorization URL to redirect the user to
- `redirect` `boolean` _(required)_: Indicates if the user should be redirected to the authorization URL
- `status` `boolean`

#### `400`: Bad Request. Usually due to missing parameters, or invalid parameters.

Body (`application/json`):

- `message` `string` _(required)_

#### `401`: Unauthorized. Due to missing or invalid authentication.

Body (`application/json`):

- `message` `string` _(required)_

#### `403`: Forbidden. You do not have permission to access this resource or to perform this action.

Body (`application/json`):

- `message` `string`

#### `404`: Not Found. The requested resource was not found.

Body (`application/json`):

- `message` `string`

#### `429`: Too Many Requests. You have exceeded the rate limit. Try again later.

Body (`application/json`):

- `message` `string`

#### `500`: Internal Server Error. This is a problem with the server that you cannot fix.

Body (`application/json`):

- `message` `string`

### Example request

```bash
curl https://api.openfort.io/iam/v2/auth/link-social \
  --request POST \
  --header 'Content-Type: application/json' \
  --data '{
  "callbackURL": "string",
  "provider": "string",
  "idToken": {
    "token": "string",
    "nonce": "string",
    "accessToken": "string",
    "refreshToken": "string",
    "scopes": [
      "string"
    ]
  },
  "requestSignUp": true,
  "scopes": [
    "string"
  ],
  "errorCallbackURL": "string",
  "disableRedirect": true
}'
```

```ts
fetch('https://api.openfort.io/iam/v2/auth/link-social', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    callbackURL: 'string',
    provider: 'string',
    idToken: {
      token: 'string',
      nonce: 'string',
      accessToken: 'string',
      refreshToken: 'string',
      scopes: ['string']
    },
    requestSignUp: true,
    scopes: ['string'],
    errorCallbackURL: 'string',
    disableRedirect: true
  })
})
```

## List lined accounts

`GET /iam/v2/auth/list-accounts`

List all accounts linked to the user

### Responses

#### `200`: Success

Body (`application/json`):

- `provider` `string` _(required)_
- `createdAt` `integer <int64>` _(required)_
- `updatedAt` `integer <int64>` _(required)_
- `accountId` `string` _(required)_
- `chainType` `string` _(required)_
- `chainId` `string` _(required)_
- `connectorType` `string` _(required)_
- `walletClientType` `string` _(required)_

#### `400`: Bad Request. Usually due to missing parameters, or invalid parameters.

Body (`application/json`):

- `message` `string` _(required)_

#### `401`: Unauthorized. Due to missing or invalid authentication.

Body (`application/json`):

- `message` `string` _(required)_

#### `403`: Forbidden. You do not have permission to access this resource or to perform this action.

Body (`application/json`):

- `message` `string`

#### `404`: Not Found. The requested resource was not found.

Body (`application/json`):

- `message` `string`

#### `429`: Too Many Requests. You have exceeded the rate limit. Try again later.

Body (`application/json`):

- `message` `string`

#### `500`: Internal Server Error. This is a problem with the server that you cannot fix.

Body (`application/json`):

- `message` `string`

### Example request

```bash
curl https://api.openfort.io/iam/v2/auth/list-accounts
```

```ts
fetch('https://api.openfort.io/iam/v2/auth/list-accounts')
```

## Unlink account

`POST /iam/v2/auth/unlink-account`

Unlink an account

### Request body (required) (`application/json`)

- `providerId` `string` _(required)_
- `accountId` `string | null`

### Responses

#### `200`: Success

Body (`application/json`):

- `status` `boolean` _(required)_: Indicates whether the account was successfully unlinked

#### `400`: Bad Request. Usually due to missing parameters, or invalid parameters.

Body (`application/json`):

- `message` `string` _(required)_

#### `401`: Unauthorized. Due to missing or invalid authentication.

Body (`application/json`):

- `message` `string` _(required)_

#### `403`: Forbidden. You do not have permission to access this resource or to perform this action.

Body (`application/json`):

- `message` `string`

#### `404`: Not Found. The requested resource was not found.

Body (`application/json`):

- `message` `string`

#### `429`: Too Many Requests. You have exceeded the rate limit. Try again later.

Body (`application/json`):

- `message` `string`

#### `500`: Internal Server Error. This is a problem with the server that you cannot fix.

Body (`application/json`):

- `message` `string`

### Example request

```bash
curl https://api.openfort.io/iam/v2/auth/unlink-account \
  --request POST \
  --header 'Content-Type: application/json' \
  --data '{
  "providerId": "string",
  "accountId": "string"
}'
```

```ts
fetch('https://api.openfort.io/iam/v2/auth/unlink-account', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    providerId: 'string',
    accountId: 'string'
  })
})
```

## Get account info

`POST /iam/v2/auth/account-info`

Get the account info provided by the provider

### Request body (required) (`application/json`)

- `accountId` `string` _(required)_: The provider given account id for which to get the account info

### Responses

#### `200`: Success

Body (`application/json`):

- `user` `object` _(required)_
  - `id` `string` _(required)_
  - `name` `string`
  - `email` `string`
  - `image` `string`
  - `emailVerified` `boolean` _(required)_
- `data` `object` _(required)_

#### `400`: Bad Request. Usually due to missing parameters, or invalid parameters.

Body (`application/json`):

- `message` `string` _(required)_

#### `401`: Unauthorized. Due to missing or invalid authentication.

Body (`application/json`):

- `message` `string` _(required)_

#### `403`: Forbidden. You do not have permission to access this resource or to perform this action.

Body (`application/json`):

- `message` `string`

#### `404`: Not Found. The requested resource was not found.

Body (`application/json`):

- `message` `string`

#### `429`: Too Many Requests. You have exceeded the rate limit. Try again later.

Body (`application/json`):

- `message` `string`

#### `500`: Internal Server Error. This is a problem with the server that you cannot fix.

Body (`application/json`):

- `message` `string`

### Example request

```bash
curl https://api.openfort.io/iam/v2/auth/account-info \
  --request POST \
  --header 'Content-Type: application/json' \
  --data '{
  "accountId": "string"
}'
```

```ts
fetch('https://api.openfort.io/iam/v2/auth/account-info', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    accountId: 'string'
  })
})
```
