# Initialize Referd User Profile

Showing the **Referd** widget on your mobile application is slightly different than showing it on the website. You have two options; first, if you want to design your customer interface, you will use our set of REST APIs. \
\
The other option as this section elaborates, is through using our Flutter SDK.

Using the SDK, you can open the **Referd** user profile from a button in your app, programmatically when someone does something, or from a persistent button that sits over your app’s UI.

When you trigger the **Referd** user profile, your player is presented with a home screen. This is configurable inside **Referd** to change how it looks and what’s presented.

From there, your user can check his progress across different **Referd** programs as per your configurations.

<figure><img src="/files/mBylAlCOJa6y8ppDF8FH" alt=""><figcaption></figcaption></figure>

**Referd’s** views are accessible through the code below. You just need to use it on any button action.&#x20;

{% code overflow="wrap" %}

```swift
// If you want to create/Update User just create 
//Send with from string then convert it to json or create a json and sent it directly

let playerAttributesString =  '''
{
  "playerUniqueId": <PLAYER_ID>,
  "mobile": "+1234567",
  "email": "jon.snow@example.com",
  "playerAttributes": {
    "displayName": "Jon Snow",
  },
  "levelOrder": null
}
''';

 final Map<String, dynamic> playerData = jsonDecode(playerDataString);

```

{% endcode %}

<pre class="language-swift"><code class="lang-swift">     apiKey: &#x3C;YOUR_API_KEY>,
     playerUniqueId: &#x3C;YOUR_PLAYER_UNIQUE_ID>,
     lang: 'en',
<strong>     playerAttributes: playerData
</strong>   );
 

// In your widget just path thr context for the sdk like 
 gameball.openGameballView(context);
   
   
   
</code></pre>

Once the **APIKey** and **playerUniqueId** have been registered, **Referd** views can be made visible to the user.

The below is description of Initialization params

<table data-header-hidden><thead><tr><th width="210"></th><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td>Type</td><td><strong>Required</strong></td><td><strong>Description</strong></td></tr><tr><td><code>APIKey</code></td><td><strong>string</strong></td><td><strong>Yes</strong></td><td>Client API key</td></tr><tr><td><code>playerUniqueId</code></td><td><strong>string</strong></td><td><strong>Yes</strong></td><td><p>Unique identifier for the user in your database.</p><p>Could be database ID, random string, email or anything that uniquely identifies the user.</p></td></tr><tr><td><code>lang</code></td><td><strong>string</strong></td><td><strong>No</strong></td><td><p>Your platform language preference to view <strong>Referd</strong> Widget with.</p><p><strong>Note:</strong> The language provided should be as per configured languages in your account.</p><p><strong>Example:</strong> <code>"en"</code>, <code>"fr"</code>.</p></td></tr></tbody></table>

{% hint style="success" %}
Everytime the **Referd View** is initialized with a new **PlayerUniqueId** , the user profile is created or updated at **Referd** side. You may consider enriching your **Referd's** user profile with attributes that are not available to the UI by using server side [Create\Update User API](/api-reference/api-reference/player.md#post-create-player)
{% endhint %}

{% hint style="warning" %}
**Choose an Unchangeable Player Unique ID**

**Referd** user profile gets created using the **`playerUniqueId`**. It is highly recommended to have the unique ID as an identifier that would NEVER be changed. If this unique ID changes for a given user, you risk losing all original data for that user on **Referd**. Accordingly, it is NOT recommended to use email address or mobile number as the unique ID as both can be changed by the user at anytime.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.tryreferd.com/installing-referd/referd-for-flutter/show-referd-user-profile.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
