# Quickstart

Get up and running with the MoreLogin API in 5 minutes.

## Browser Automation (Local API)

**Scenario:** Create a browser profile, launch it, connect via Puppeteer to run a script, and then stop it.

### Prerequisites

- MoreLogin desktop app **v2.15.0+** installed and running locally.
- Puppeteer installed (`npm i puppeteer-core`).


### Step 1: Create a Browser Profile


```bash
curl -X POST "http://127.0.0.1:40000/api/env/create/quick" \
  -H "Content-Type: application/json" \
  -d '{
    "browserTypeId": 1,
    "operatorSystemId": 1,
    "quantity": 1
  }'
```

*Save the `envId` from the response (e.g., `1993244721490239488`).*

### Step 2: Start the Profile & Get Debug Port


```bash
curl -X POST "http://127.0.0.1:40000/api/env/start" \
  -H "Content-Type: application/json" \
  -d '{"envId": "1993244721490239488"}'
```

*The response will include the `debugPort` (e.g., `12345`).*

### Step 3: Connect Puppeteer (Node.js)


```javascript
const puppeteer = require('puppeteer-core');

(async () => {
  const browser = await puppeteer.connect({
    browserURL: 'http://127.0.0.1:12345'
  });
  const page = await browser.newPage();
  await page.goto('https://www.morelogin.com');
  console.log(await page.title());
  await browser.disconnect();
})();
```

### Step 4: Stop the Profile


```bash
curl -X POST "http://127.0.0.1:40000/api/env/close" \
  -H "Content-Type: application/json" \
  -d '{"envId": "1993244721490239488"}'
```

## Cloud Phone Management (Open API)

**Scenario:** Quick-create a cloud phone, start it, install an application, and trigger an RPA schedule.

### Prerequisites

- API ID and API Key from the MoreLogin dashboard.


### Step 1: Get Access Token


```bash
curl -X POST "https://api.morelogin.com/oauth2/token" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "YOUR_API_ID",
    "client_secret": "YOUR_API_KEY",
    "grant_type": "client_credentials"
  }'
```

*Save the `access_token` from the response.*

### Step 2: Quick Create & Start Cloud Phone


```bash
curl -X POST "https://api.morelogin.com/cloudphone/newMachine" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "androidVersion": 10,
    "duration": 30,
    "unit": 1
  }'
```

*Save the `id` (Cloud Phone ID) from the response.*

### Step 3: Install an App

Assuming you already have an `appVersionId` from the app library:


```bash
curl -X POST "https://api.morelogin.com/cloudphone/app/install" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "id": 1673823102599682,  # Your Cloud Phone ID
    "appVersionId": "1672940217990530"
  }'
```

### Step 4: Run an RPA Schedule

Execute a pre-configured automation script on your new cloud phone:


```bash
curl -X POST "https://api.morelogin.com/cloudphone/rpa/onceTask/save" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "cloudPhoneId": 1673823102599682,
    "scheduleName": "Daily Login Task",
    "templateId": 987654321
  }'
```

## What's Next?

| Goal | Go to |
|  --- | --- |
| Full Browser Profile API reference | [Browser API](/api-reference/browser/local-api) |
| Full Cloud Phone API reference | [Cloud Phone API](/api-reference/cloud-phone/open-api) |
| Set up Docker for headless mode | [Docker Deployment](#) |
| Connect via ADB | [ADB Connection Guide](/api-reference/cloud-phone/adb) |