> For the complete documentation index, see [llms.txt](https://onairos.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onairos.gitbook.io/docs/developer-guides/integrate-onairos-mobile/1-line-of-code.md).

# 1 Line of Code

![](/files/3av3znSfO1RjQmK4HdgZ)

Instantiate the Onairos object from the Onairos package to add the Onairos button onto your application which asks the user for the Persona Data

{% tabs %}
{% tab title="swift" %}

<pre class="language-javascript"><code class="lang-javascript">await initializeApiKey({
<strong>    apiKey: API_KEY, 
</strong>});
</code></pre>

{% endtab %}

{% tab title="react-native" %}

```jsx
<OnairosButton
  AppName="YourAppName"
  onResolved={handleComplete}
  requestData={{
    personality_traits: {
      name: "Personality Analysis",
      description: "AI analysis of your social media personality",
      reward: "Personalized recommendations"
    },
    sentiment_analysis: {
      name: "Interest Analysis", 
      description: "Understanding your interests and preferences",
      reward: "Content tailored to your interests"
    }
  }}
  debug={true}  // Enable for development
  testMode={true}  // Enable for testing
  auto={true}  // 🚀 MAGIC: Auto-fetch data without UI if user is already authenticated
/>
```

{% endtab %}

{% tab title="Dart(Flutter)" %}

```dart
actions:  [
          OnairosButtonWrapper1(
            webpageName: 'Mobile App', 
            requestData: requestData,
            returnLink: 'yourapp://returnlink',
            autoFetch: true,
            onResolved: onResolved,
            inferenceData: data,
            proofMode: false,
            textColor: color,
            textLayout: layout,
          ),
        ],
```

{% endtab %}
{% endtabs %}

Onairos Object fields:

* <mark style="color:red;">webpageName</mark> - String - **Required** - App Display Name
* <mark style="color:red;">requestData</mark> - Json - **Required** - User Request data ([See Below)](#request-data-object)&#x20;
* <mark style="color:red;">returnLink</mark> - String - **Required** - Registered Universal Link of your App&#x20;
* <mark style="color:red;">textColor</mark> - String - **Optional** - Text Color of Onairos Button

  ```typescript
  'black' | 'white'
  ```
* <mark style="color:red;">textLayout</mark> - String - **Optional** - Position of Onairos Title relative to Button Icon

  ```typescript
  'right' | 'left' | 'below' | 'none';
  ```
* <mark style="color:red;">autoFetch</mark> - Boolean - **Optional** - Whether to automatically fetch user data as soon as they consent&#x20;
* <mark style="color:red;">onComplete</mark> - Function - **Optional** - Function to fetch user data via API manually

  ```typescript
        onComplete: (data: any, error?: Error) => void; 
  ```
* <mark style="color:red;">inferenceData</mark> - Json ([Format](/docs/developer-guides/integrate-onairos-web/manual-api-call/using-the-inference-api.md#input-format)) - **Optional (Required if autoFetch = true)** -  Inference Input Data

### Request Data Object

```json
"RequestObject":{ 
    personality_traits: {
      name: "Fashion Personality Analysis",
      description: "Deep analysis of your Personality for fashion recommendations",
      reward: "10% discount from next basket"
    },
    sentiment_analysis: {
      name: "Recent Interest and Themes", 
      description: "Understanding your interests and preferences for fashion recommendations",
      reward: "1 free recommended item"
    }
  }
```

```json
```

#### Setup the Onairos Connection Object

Create the Request Object which Users will Authorize (or not) in the overlay popup

RequestObject.name key:

* `personality_traits` - A distillation of the users most unique traits and personality
* `sentiment_analysis` - You provide a text/image (video/sound soon) input (<mark style="color:red;">inferenceData</mark>) into our API and we provide a score of how much the user liked or disliked that item. These could be genres of movies or items, categories or archetypes of people, personality types, best selling items etc

Individual Request Information:

* `name`: Name of your request
* `description`: Description to display to users about your request
* `reward`: Reward Given to User for granting Data Request

## That is all for the setup and users you can now recieve user data in the OnComplete function

Please go to our [Demo](https://internship.onairos.uk) to see an example Onairos integration

**If you set autoFetch = false, you will need to manually fetch the user data using the** [**following**](/docs/developer-guides/integrate-onairos-mobile/manual-api-call/receiving-api.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://onairos.gitbook.io/docs/developer-guides/integrate-onairos-mobile/1-line-of-code.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
