# Create One-Time Schedule

Create a one-time scheduled task for a cloud phone using a marketplace or personal RPA template.


---

### `templateParameter` Reference
The `templateParameter` field accepts a **JSON-escaped string** containing key-value pairs that correspond to the template's declared parameters.
#### 1. Where to find parameter keys
Retrieve the `parameter` field from either:
- `POST /api/cloudphone/rpa/template/market/page` (marketplace templates)
- `POST /api/cloudphone/rpa/template/personal/page` (personal templates)

#### 2. Supported value types
| Type | Example |
|  --- | --- |
| `string` | `{"name": "John"}` |
| `number` | `{"amount": 100.50}` |
| `boolean` | `{"enabled": true}` |
| `image` / `video` | See media format below |

#### 3. Media parameters (image / video)
Media parameters require an additional `__Extra__` key containing file metadata:
For files already uploaded to MoreLogin Cloud Storage, use the cloud file protocol as the parameter value:
`morelogin://cloudfile?ids=1,2`. The `ids` value is a comma-separated list of Cloud Storage file IDs.

```json
{
  "__Extra__": {
    "pic": { "name": "photo.png", "size": 204800 },
    "video": { "name": "clip.mp4", "size": 204800000 }
  },
  "pic": "https://example.com/photo.png",
  "video": "https://example.com/clip.mp4"
}
```
#### 4. Step-by-step example
**Step 1** — Call the marketplace template API and extract the `parameter` field from the response.
**Step 2** — Build a JSON object with the required parameter keys and values:

```json
{
  "__Extra__": {
    "videoDownloadUrl": { "name": "video.mp4", "size": 204800000 }
  },
  "videoDownloadUrl": "morelogin://cloudfile?ids=1,2"
}
```
**Step 3** — Escape the JSON object into a string:

```
"{\"__Extra__\":{\"videoDownloadUrl\":{\"name\":\"video.mp4\",\"size\":204800000}},\"videoDownloadUrl\":\"morelogin://cloudfile?ids=1,2\"}"
```
**Step 4** — Pass the escaped string as the `templateParameter` value in your API request.

Endpoint: POST /api/cloudphone/rpa/onceTask/save
Version: 1.0.0

## Request fields (application/json):

  - `cloudPhoneId` (integer, required)
    Cloud phone ID

  - `scheduleName` (string, required)
    Schedule name

  - `templateId` (integer, required)
    Template ID,  Personal template or market template ID

  - `templateParameter` (string)
    JSON-escaped string of template parameter key-value pairs. Extract parameter keys from the `parameter` field returned by the List Marketplace Templates or List Personal Templates APIs. See the endpoint description above for the full specification and step-by-step example.

  - `description` (string)
    Schedule description

## Response 200 fields (application/json):

  - `code` (integer, required)
    Response code, 0 indicates success,>0 indicates failure

  - `msg` (string, required)
    Error msg

  - `requestId` (string, required)
    Request trace id

  - `data` (integer, required)
    Schedules id

