Plaid Layer integration guide 
==============================

#### Use Plaid Layer to instantly onboard new customers 

In this guide, we'll start from scratch and walk through how to use [Plaid Layer](https://plaid.com/docs/api/products/layer/index.html.md) to create a fast, frictionless onboarding experience for your customers.

If you're already familiar with Link, you can skip to [Create a Link token](https://plaid.com/docs/layer/add-to-app/index.html.md#create-a-link-token) .

#### Get Plaid API keys and complete application and company profile 

If you don't already have one, you'll need to [create a Plaid developer account](https://dashboard.plaid.com/signup) . After creating your account, you can find your [API keys](https://dashboard.plaid.com/developers/keys) under the Developers menu on the Plaid Dashboard.

You will also need to complete your [application profile](https://dashboard.plaid.com/settings/company/app-branding) and [company profile](https://dashboard.plaid.com/settings/company/profile) in the Dashboard. The information in your profile will be shared with users of your application when they manage their connection on the [Plaid Portal](https://my.plaid.com) .

#### Install and initialize Plaid libraries 

You can use our official server-side client libraries to connect to the Plaid API from your application:

```node
// Install via npm
npm install --save plaid

```

```bash
## Not applicable with curl calls

```

```ruby
# Available as a gem
gem install plaid

```

```java
/*
For Gradle, add the following dependency to your build.gradle and replace {VERSION} with the version number you want to use from
- https://github.com/plaid/plaid-java/releases/latest
*/
implementation "com.plaid:plaid-java:{VERSION}"

/*
For Maven, add the following dependency to your POM and replace {VERSION} with the version number you want to use from
- https://github.com/plaid/plaid-java/releases/latest
*/

  com.plaid
  plaid-java
  {VERSION}


```

```python
# Install through pip, only supports Python 3
pip install --upgrade plaid-python

```

```go
go get github.com/plaid/plaid-go

```

After you've installed Plaid's client libraries, you can initialize them by passing in your `client_id`, `secret`, and the environment you wish to connect to (Sandbox or Production). This will make sure the client libraries pass along your `client_id` and `secret` with each request, and you won't need to explicitly include them in any other calls.

```node
// Using Express
const express = require('express');
const app = express();
app.use(express.json());

const { Configuration, PlaidApi, PlaidEnvironments } = require('plaid');

const configuration = new Configuration({
  basePath: PlaidEnvironments.sandbox,
  baseOptions: {
    headers: {
      'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID,
      'PLAID-SECRET': process.env.PLAID_SECRET,
    },
  },
});

const client = new PlaidApi(configuration);

```

```bash
## Not applicable with curl calls

```

```ruby
require 'sinatra'
require 'plaid'

set :port, ENV['APP_PORT'] || 8000

configuration = Plaid::Configuration.new
configuration.server_index = Plaid::Configuration::Environment[ENV['PLAID_ENV'] || 'sandbox']
configuration.api_key['PLAID-CLIENT-ID'] =  ENV['PLAID_CLIENT_ID']
configuration.api_key['PLAID-SECRET'] = ENV['PLAID_SECRET']

api_client = Plaid::ApiClient.new(
  configuration
)

client = Plaid::PlaidApi.new(api_client)

```

```java
import java.net.*;
import java.io.*;
import retrofit2.Response;
import java.util.Arrays;
import com.sun.net.httpserver.*;

import com.plaid.client.ApiClient;
import com.plaid.client.request.PlaidApi;

public class PlaidExample {
  private static final String CLIENT_ID = System.getenv("PLAID_CLIENT_ID");
  private static final String SECRET = System.getenv("PLAID_SECRET");

  public static void main(String[] args) {
    HttpServer server = HttpServer.create(
      new InetSocketAddress("localhost", 8000), 0);
    server.createContext("/create_link_token", new GetLinkToken());
    server.setExecutor(null);
    server.start();
  }

  // Additional server code goes here

}

```

```python
import plaid
from plaid.api import plaid_api

from flask import Flask
from flask import render_template
from flask import request
from flask import jsonify

app = Flask(name)

configuration = plaid.Configuration(
  host=plaid.Environment.Sandbox,
  api_key={
    'clientId': PLAID_CLIENT_ID,
    'secret': PLAID_SECRET,
  }
)

api_client = plaid.ApiClient(configuration)
client = plaid_api.PlaidApi(api_client)

# Additional server code goes here

if __name__ == "__main__":
    app.run(port=8000)

```

```go
import (
    "context"
    "net/http"
    "os"

    "github.com/gin-gonic/gin"
    "github.com/plaid/plaid-go/v3/plaid"
)


configuration := plaid.NewConfiguration()
configuration.AddDefaultHeader("PLAID-CLIENT-ID", os.Getenv("CLIENT_ID"))
configuration.AddDefaultHeader("PLAID-SECRET", os.Getenv("SECRET"))
configuration.UseEnvironment(plaid.Sandbox)
client := plaid.NewAPIClient(configuration)


func main() {
  r := gin.Default()
  // Server endpoints would be declared here
  // e.g.  r.POST("/create_link_token", createLinkToken)
 r.POST("/create_link_token", createLinkToken)

  err := r.Run(":8000")
  if err != nil {
    panic("unable to start server")
  }
}

```

#### Launch Link 

Plaid Link is a drop-in module that provides a secure, elegant flow for Layer. Before initializing Link, you will need to create a new `link_token` on the server side of your application. A `link_token` is a short-lived, one-time use token that is used to authenticate your app with Link. You can create one using the [/session/token/create](https://plaid.com/docs/api/products/layer/index.html.md#sessiontokencreate) endpoint. Then, on the client side of your application, you'll need to initialize Link with the `link_token` that you just created.

##### Create a Link token 

Unlike a regular Link flow, the starting point for Layer is a call to [/session/token/create](https://plaid.com/docs/api/products/layer/index.html.md#sessiontokencreate) with a specified `TEMPLATE_ID`. The template should be created and configured in the dashboard ahead of time. If you want to use other products in addition to the `layer` product, make sure your template has them enabled.

```node
app.post('/api/create_session_token', async function (request, response) {
  // Get the client_user_id by searching for the current user
  const user = await User.find(...);
  const clientUserId = user.id;
  const sessionTokenRequest = {
    user: {
      // This should correspond to a unique id for the current user.
      client_user_id: clientUserId,
    },
    template_id: TEMPLATE_ID,
  };
  try {
    const createTokenResponse = await client.sessionTokenCreate(sessionTokenRequest);
    response.json(createTokenResponse.data);
  } catch (error) {
    // handle error
  }
});

```

```bash
curl -X POST https://sandbox.plaid.com/session/token/create \
-H 'Content-Type: application/json' \
-d '{
  "client_id": "${PLAID_CLIENT_ID}",
  "secret": "${PLAID_SECRET}",
  "user": { "client_user_id": "${UNIQUE_USER_ID}" },
  "template_id": "${TEMPLATE_ID}"
}'

```

```ruby
post '/api/create_session_token' do
  # Get the client_user_id by searching for the current user
  current_user = User.find(...)
  client_user_id = current_user.id

  # Create a session_token for the given user
  request = Plaid::SessionTokenCreateRequest.new(
    {
      user: { client_user_id: client_user_id },
      template_id: TEMPLATE_ID
    }
  )
  response = client.session_token_create(request)
  content_type :json
  response.to_json
end

```

```java
import com.plaid.client.model.SessionTokenCreateRequest;
import com.plaid.client.model.SessionTokenCreateRequestUser;
import com.plaid.client.model.SessionTokenCreateResponse;

public class PlaidExample {

  ...
  static class GetSessionToken implements HttpHandler {
    private static PlaidApi plaidClient;

    public void handle(HttpExchange t) throws IOException {
      // Create your Plaid client
      HashMap apiKeys = new HashMap();
      apiKeys.put("clientId", CLIENT_ID);
      apiKeys.put("secret", SECRET);
      ApiClient apiClient = new ApiClient(apiKeys);
      apiClient.setPlaidAdapter(ApiClient.Sandbox);

      plaidClient = apiClient.createService(PlaidApi.class);

      // Get the clientUserId by searching for the current user
      User userFromDB = db.find(...);
      String clientUserId = userFromDB.id;
      SessionTokenCreateRequestUser user = new SessionTokenCreateRequestUser()
        .clientUserId(clientUserId);

      // Create a session_token for the given user
      SessionTokenCreateRequest request = new SessionTokenCreateRequest()
        .user(user)
        .templateId(TEMPLATE_ID);

      Response response = plaidClient
        .sessionTokenCreate(request)
        .execute();

      // Send the data to the client
      return response.body();
    }
  }
}

```

```python
from plaid.model.session_token_create_request import SessionTokenCreateRequest
from plaid.model.session_token_create_request_user import SessionTokenCreateRequestUser

@app.route("/create_session_token", methods=['POST'])
def create_session_token():
    # Get the client_user_id by searching for the current user
    user = User.find(...)
    client_user_id = user.id

    # Create a session_token for the given user
    request = SessionTokenCreateRequest(
            user=SessionTokenCreateRequestUser(
                client_user_id=client_user_id
            ),
            template_id=TEMPLATE_ID
        )
    response = client.session_token_create(request)

    # Send the data to the client
    return jsonify(response.to_dict())


```

```go
func createSessionToken(c *gin.Context) {
  ctx := context.Background()

  // Get the client_user_id by searching for the current user
  user, _ := usermodels.Find(...)
  clientUserId := user.ID.String()

  // Create a session_token for the given user
  request := plaid.NewSessionTokenCreateRequest(TEMPLATE_ID, *plaid.NewSessionTokenCreateRequestUser(clientUserId))

  resp, _, err := testClient.PlaidApi.SessionTokenCreate(ctx).SessionTokenCreateRequest(*request).Execute()

  // Send the data to the client
  c.JSON(http.StatusOK, gin.H{
    "session_token": resp.GetLink().GetLinkToken(),
  })
}


```

##### Install the Link SDKs 

For instructions on installing Link SDKs, see the [Link documentation](https://plaid.com/docs/link/index.html.md) for your platform: [iOS](https://plaid.com/docs/link/ios/index.html.md) , [Android](https://plaid.com/docs/link/android/index.html.md) , [React Native](https://plaid.com/docs/link/react-native/index.html.md) , or [React](https://plaid.com/docs/link/web/index.html.md) . Layer is not supported on mobile webview integrations.

As Plaid is actively adding new Layer functionality, it is strongly recommended that you use the latest SDK version if your app uses Layer.

If you are developing a native mobile application, Layer requires SDK versions from June 2024 or later. Minimum versions are 6.0.4 (iOS), 4.5.0 (Android), 11.11.0 (React Native), and 3.5.2 (React). For Extended Autofill support, minimum versions are 6.3.1 (iOS), 5.3.0 (Android), 12.4.0 (React Native), and 4.1.1 (React).

Layer is not compatible with the [Hosted Link](https://plaid.com/docs/link/hosted-link/index.html.md) integration mode.

##### Create the Link Handler 

Basic sample code for creating the Link handler is shown below. For more details, see the [Link documentation](https://plaid.com/docs/link/index.html.md) for your platform: [iOS](https://plaid.com/docs/link/ios/index.html.md) , [Android](https://plaid.com/docs/link/android/index.html.md) , [React Native](https://plaid.com/docs/link/react-native/index.html.md) , or [React](https://plaid.com/docs/link/web/index.html.md) .

Ensure you are creating a Link token and passing it to the Link SDK as early as possible. The more time between when you create your handler and when you open Link, the better the UX will be for your users.

If you already have an existing Android or React Native integration created prior to June 2024, you will likely need to update your client-side Link opening code to support Layer. If your Android integration does not use a `PlaidHandler` or uses `OpenPlaidLink` instead of `FastOpenPlaidLink`, or if your React Native integration uses `PlaidLink` instead of `create` and `open`, you will need to add a separate handler creation step, as shown in the sample code below. For more details, see [React Native: opening Link](https://plaid.com/docs/link/react-native/index.html.md#opening-link) and [Android: opening Link](https://plaid.com/docs/link/android/index.html.md#create-a-linktokenconfiguration) .

Select group for content switcher

AndroidiOSReact NativeWeb

##### Create a LinkTokenConfiguration 

Each time you open Link, you will need to get a new `link_token` from your server and create a new `LinkTokenConfiguration` object with it.

```kotlin
val linkTokenConfiguration = linkTokenConfiguration {
  token = "LINK_TOKEN_FROM_SERVER"
}


```

```java
LinkTokenConfiguration linkTokenConfiguration = new LinkTokenConfiguration.Builder()
    .token("LINK_TOKEN_FROM_SERVER")
    .build();

```

The Link SDK runs as a separate `Activity` within your app. In order to return the result to your app, it supports both the standard `startActivityForResult` and `onActivityResult` and the `ActivityResultContract` [result APIs](https://developer.android.com/training/basics/intents/result) .

Select group for content switcher

Activity Result APIsStandard Activity APIs

##### Register a callback for an Activity Result 

```kotlin
private val linkAccountToPlaid =
registerForActivityResult(FastOpenPlaidLink()) {
  when (it) {
    is LinkSuccess -> /* handle LinkSuccess */
    is LinkExit -> /* handle LinkExit */
  }
}

```

```java
private ActivityResultLauncher linkAccountToPlaid = registerForActivityResult(new FastOpenPlaidLink(),
  result -> {
    if (result instanceof LinkSuccess) {
      /* handle LinkSuccess */
    } else {
      /* handle LinkExit */
    }
  }
);

```

##### Create a PlaidHandler 

```kotlin
val plaidHandler: PlaidHandler = 
  Plaid.create(application, linkTokenConfiguration)

```

```java
plaidHandler = Plaid.create(this.getApplication(), linkTokenConfiguration);

```

##### Open Link 

```kotlin
linkAccountToPlaid.launch(plaidHandler)

```

```java
linkAccountToPlaid.launch(plaidHandler);

```

##### Create a Configuration 

Once the Link token is passed to your app, you will create an instance of `LinkTokenConfiguration`, then create a Handler using `Plaid.create()` passing the previously created `LinkTokenConfiguration`.

```swift
var linkConfiguration = LinkTokenConfiguration(
    token: "<#LINK_TOKEN_FROM_SERVER#>",
    onSuccess: { linkSuccess in
        // Send the linkSuccess.publicToken to your app server.
    }
)

```

```objectivec
PLKLinkTokenConfiguration* linkConfiguration = [PLKLinkTokenConfiguration createWithToken:"<#LINK_TOKEN_FROM_SERVER#>"
                                                                                onSuccess:^(PLKLinkSuccess *linkSuccess) {
  // Send the linkSuccess.publicToken to your app server.
}];

```

##### Create a Handler 

A `Handler` is a one-time use object used to open a Link session. The `Handler` must be retained for the duration of the Plaid SDK flow. It will also be needed to respond to OAuth Universal Link redirects. For more details, see the [OAuth guide](https://plaid.com/docs/link/oauth/index.html.md#ios) .

```swift
let result = Plaid.create(configuration)
switch result {
  case .failure(let error):
      logger.error("Unable to create Plaid handler due to: \(error)")
  case .success(let handler):
      self.handler = handler
}

```

```objectivec
NSError *createError = nil;
id handler = [PLKPlaid createWithLinkTokenConfiguration:linkConfiguration
                                                              error:&createError];
if (handler) {
    self.linkHandler = handler;
} else if (createError) {
    NSLog(@"Unable to create PLKHandler due to: %@", createError);
}

```

Initiate the Link preloading process by invoking the `create` function.

Invoke Link create method

```javascript
<TouchableOpacity
  style={styles.button}
  onPress={() => {
      create({token: linkToken});
      setDisabled(false);
    }
  }>
  <Text style={styles.button}>Create Link</Text>
</TouchableOpacity>
```

Call `Plaid.create` (or, if using React, `usePlaidLink`) when initializing the view that is responsible for loading Plaid.

```javascript
const handler = Plaid.create({
  token: 'GENERATED_LINK_TOKEN',
  onSuccess: (public_token, metadata) => {},
  onLoad: () => {},
  onExit: (err, metadata) => {},
  onEvent: (eventName, metadata) => {},
});

```

```tsx
// The usePlaidLink hook manages Plaid Link creation
// It does not return a destroy function;
// instead, on unmount it automatically destroys the Link instance
const config: PlaidLinkOptions = {
  onSuccess: (public_token, metadata) => {},
  onExit: (err, metadata) => {},
  onEvent: (eventName, metadata) => {},
  token: 'GENERATED_LINK_TOKEN',
};

const { open, exit, ready, submit } = usePlaidLink(config);

```

#### Submit the user's phone number 

Call the `submit` method on the Plaid handler you created earlier with the user's phone number. The semantics depend on the language/platform, but all methods are called `submit`.

Select group for content switcher

AndroidiOSReact NativeWeb

```kotlin
val submissionData = SubmissionData(phoneNumber)
plaidHandler.submit(submissionData)

```

```java
SubmissionData submissionData = new SubmissionData(phoneNumber);
plaidHandler.submit(submissionData);

```

Swift sample code

```swift
// Create a model that conforms to the SubmissionData interface
struct PlaidSubmitData: SubmissionData {
    var phoneNumber: String?
}

let data = PlaidSubmitData(phoneNumber: "14155550015")

self.handler.submit(data)
```

```javascript
submit({
  "phone_number": "+14155550123"
})
```

```javascript
handler.submit({
  "phone_number": "+14155550123"
})
```

#### Submit the user's date of birth 

Upon receiving `LAYER_NOT_AVAILABLE` after phone number submission, collect the user's date of birth and call the `submit` method on the existing Plaid handler. For more details, see [Extended Autofill](https://plaid.com/docs/layer/index.html.md#extended-autofill) .

This functionality requires minimum SDK versions 6.3.1 (iOS), 5.3.0 (Android), 12.4.0 (React Native), and 4.1.1 (React). If you are using an older SDK version or do not wish to use Extended Autofill, you can skip this step.

Select group for content switcher

AndroidiOSReact NativeWeb

```kotlin
val submissionData = SubmissionData(dateOfBirth = "1975-01-18")
plaidHandler.submit(submissionData)

```

```java
SubmissionData submissionData = new SubmissionData("1975-01-18");
plaidHandler.submit(submissionData);

```

Swift sample code

```swift
// Create a model that conforms to the SubmissionData interface
struct PlaidSubmitData: SubmissionData {
    var dateOfBirth: String?
    var phoneNumber: String?
}

let data = PlaidSubmitData(dateOfBirth: "1975-01-18")

self.handler.submit(data)
```

```javascript
submit({
  "date_of_birth": "1975-01-18"
})
```

```javascript
handler.submit({
  "date_of_birth": "1975-01-18"
})
```

#### Open Layer UI on the LAYER\_READY event 

Listen to the events on the Plaid handler via `onEvent`. For platform-specific details, see the [Link documentation](https://plaid.com/docs/link/index.html.md) for your platform.

If you receive `LAYER_READY`, the user is eligible for the Layer flow and you should proceed to open Link according to the [Link documentation](https://plaid.com/docs/link/index.html.md) for your platform.

If you receive `LAYER_AUTOFILL_NOT_AVAILABLE` (or if you receive `LAYER_NOT_AVAILABLE` and have not built Extended Autofill support for your integration), the user is not eligible for the Layer flow. You can clean up the handler you created earlier and fall back to whatever non-Layer onboarding flow fits your application (e.g. a traditional Link session, or other custom flow for your app).

Select group for content switcher

AndroidiOSReact NativeWeb

```kotlin
Plaid.setLinkEventListener { event ->
    when(event.eventName) {
        is LAYER_READY -> {
            // open link
            linkAccountToPlaid.launch(plaidHandler)
        }
        is LAYER_NOT_AVAILABLE -> {
            // run fall back flow
        }
        else -> { Log.i("Event", event.toString()) }
    }
}

```

```java
Plaid.setLinkEventListener(new LinkEventListener() {
    @Override
    public void onEvent(LinkEvent event) {
        switch (event.getEventName()) {
            case LAYER_READY:
                // Open link
                linkAccountToPlaid.launch(plaidHandler);
                break;
            case LAYER_NOT_AVAILABLE:
                // Run fallback flow
                break;
            default:
                Log.i("Event", event.toString());
        }
    }
});

```

Swift sample code

```swift
var linkSessionID: String?

linkTokenConfiguration.onEvent = { [weak self] linkEvent in
    guard let self = self else { return }
    switch linkEvent.eventName {
        case .layerReady:
            self.handler.open(presentUsing: .viewController(self))
            break
        case .layerNotAvailable:
            // Fall back on non-Layer flows, clean up
            break
        default:
            // Other cases ignored in this use case.
            break
    }
}
```

JavaScript sample code

```javascript
usePlaidEmitter((event: LinkEvent) => {
  switch (event.eventName) {
    case LinkEventName.LAYER_READY:
      // Open Link
      open({...})
      break;
    case LinkEventName.LAYER_NOT_AVAILABLE:
      // Run another fallback flow
      break;
    default:
      // Other cases ignored in this use case
      break;
  }
});
```

JavaScript sample code

```javascript
//Same onEvent handler from Link create sample
onEvent: (eventName, metadata) => {
  switch(eventName) {
    case "LAYER_READY":
      // Open Link
      open({...})
      break;
  case "LAYER_NOT_AVAILABLE":
    // Run another fallback flow
    break;
  default:
    //Other cases ignored in this use case
    break;
  }
}
```

#### Get the public token from the onSuccess callback 

On successful completion, an `onSuccess` callback will be invoked, similar to the standard Link flow. Capture the `public_token` from `onSuccess`.

Select group for content switcher

AndroidiOSReact NativeWeb

```kotlin
val profileToken = success.publicToken
// Send the public token to your backend

```

```java
String profileToken = success.getPublicToken();
// Send the public token to your backend

```

Swift sample code

```swift
onSuccess: { linkSuccess in
}
// Send the public token to your backend
```

JavaScript sample code

```javascript
const onSuccess = (linkSuccess: LinkSuccess) => {
  let publicToken = linkSuccess.publicToken;
  // Send the public token to your backend
};
```

JavaScript sample code

```javascript
onSuccess: (public_token) => {
  const publicToken = public_token;
  // Send the public token to your backend
};
```

#### Get user account data 

Call [/user\_account/session/get](https://plaid.com/docs/api/products/layer/index.html.md#user_accountsessionget) to retrieve user-permissioned identity information as well as Item access tokens. Unlike typical Plaid Link sessions, where you must first exchange your public token for an access token in order to talk to the Plaid API, the [/user\_account/session/get](https://plaid.com/docs/api/products/layer/index.html.md#user_accountsessionget) endpoint allows you to retrieve user-permissioned identity information as well as Item access tokens in a single call. You can optionally use Plaid products such as [Identity Match](https://plaid.com/docs/identity/index.html.md#identity-match) or [Identity Verification](https://plaid.com/docs/identity-verification/index.html.md) if you wish to verify this data.

Because Layer already verifies your user's phone number via OTP or SNA, for a low-friction experience, you should _not_ perform additional OTP phone number verification as long as Layer has verified the number.

The best indication that the number was verified is the [LAYER\_AUTHENTICATION\_PASSED](https://plaid.com/docs/api/products/layer/index.html.md#layer_authentication_passed) webhook. Before skipping OTP verification based on this webhook, be sure to implement [webhook verification](https://plaid.com/docs/api/webhooks/webhook-verification/index.html.md) to protect against webhook spoofing attacks.

Alternatively, you can use Link completion to indicate that the number was verified, but this method will exclude sessions where the user verified their number without fully completing Link. To use this method, call [/user\_account/session/get](https://plaid.com/docs/api/products/layer/index.html.md#user_accountsessionget) ; the `phone_number` returned is the verified number. Do not rely on the `onSuccess` callback, as this can be vulnerable to client-side spoofing attacks.

```node
const request: UserAccountSessionGetRequest = {
  public_token: 'profile-sandbox-b0e2c4ee-a763-4df5-bfe9-46a46bce992d',
};
try {
  const response = await client.userAccountSessionGet(request);
} catch (error) {
  // handle error
}

```

```bash
curl -X POST https://sandbox.plaid.com/user_account/session/get \
-H 'Content-Type: application/json' \
-d '{
  "public_token": "profile-sandbox-b0e2c4ee-a763-4df5-bfe9-46a46bce992d",
  "client_id": "${PLAID_CLIENT_ID}",
  "secret": "${PLAID_SECRET}"
}'

```

```ruby
request = Plaid::UserAccountSessionGetRequest.new(
  {
    public_token: 'profile-sandbox-b0e2c4ee-a763-4df5-bfe9-46a46bce992d'
  }
)
response = client.user_account_session_get(request)

```

```java

UserAccountSessionGetRequest request = new UserAccountSessionGetRequest()
  .publicToken("profile-sandbox-b0e2c4ee-a763-4df5-bfe9-46a46bce992d");

Response response = client()
  .userAccountSessionGet(request)
  .execute();

```

```python
request = UserAccountSessionGetRequest(
    public_token='profile-sandbox-b0e2c4ee-a763-4df5-bfe9-46a46bce992d'
)
response = client.user_account_session_get(request)

```

```go
request := plaid.NewUserAccountSessionGetRequest(
  "profile-sandbox-b0e2c4ee-a763-4df5-bfe9-46a46bce992d",
)

response, _, err := client.PlaidApi.
  UserAccountSessionGet(ctx).
  UserAccountSessionGetRequest(*request).
  Execute()

```

Layer sample response

```json
{
  "identity": {
    "phone_number": "+14155550015",
    "name": {
      "first_name": "Leslie",
      "last_name": "Knope"
    },
    "address": {
      "street": "123 Main St.",
      "street2": "Apt 123",
      "city": "Pawnee",
      "region": "Indiana",
      "postal_code": "46001",
      "country": "US"
    },
    "email": "leslie@knope.com",
    "date_of_birth": "1979-01-01",
    "ssn": "987654321",
    "ssn_last4": "4321"
  },
  "identity_edit_history": {
    "name": {
      "edits_current": 0,
      "edits_1d": 0,
      "edits_30d": 1,
      "edits_365d": 1,
      "edits_all_time": 1
    },
    "address": {
      "edits_current": 1,
      "edits_1d": 1,
      "edits_30d": 2,
      "edits_365d": 2,
      "edits_all_time": 2
    },
    "email": {
      "edits_current": 0,
      "edits_1d": 0,
      "edits_30d": 0,
      "edits_365d": 0,
      "edits_all_time": 0
    },
    "date_of_birth": {
      "edits_current": 0,
      "edits_1d": 0,
      "edits_30d": 0,
      "edits_365d": 0,
      "edits_all_time": 0
    },
    "official_document": {
      "ssn": {
        "edits_current": 0,
        "edits_1d": 0,
        "edits_30d": 0,
        "edits_365d": 0,
        "edits_all_time": 0
      }
    }
  },
  "items": [
    {
      "item_id": "<external_item_id>",
      "access_token": "access-token-<UUID>"
    }
  ],
  "request_id": "j0LkqT9OPdVwjwh"
}
```