> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/opportunity/_new.md).

# \_new

Creates a new Opportunity.

### Parameters

#### userID

The ID of the User which the Opportunity is for.

#### form\_id

The ID of a Form which the Opportunity is linked to.

#### customerID

The ID of the Customer linked to the Opportunity.

#### value

The value of the Opportunity.

#### notes

A string variable for notes within the created Opportunity.

#### source

The ID of a Source the Opportunity will be linked to.

#### createdDate

The date which the Opportunity was created on. (YYYY-MM-DD)

### Example

```
FM_api('Opportunity_new',[
  'userID'=>'92447',
  'form_id'=>'460775',
  'customerID'=>'712758',
  'value'=>'4',
  'notes'=>'New Opportunity',
  'source'=>'7',
  'createdDate'=>'2024-04-01'
]);
```

### Results

#### On Success

```
{"ok":"1","id":60003}
```

#### On Failure

If the "userID" parameter is not set:

```
{"error":"missing or invalid parameter: userID"}
```

If the "customerID" parameter is not set:

```
{"error":"missing or invalid parameter: customerID"}
```

If the "value" parameter is not set:

```
{"error":"missing or invalid parameter: value"}
```

If the "notes" parameter is not set:

```
{"error":"missing or invalid parameter: notes"}
```

If the "source" parameter is not set:

```
{"error":"missing or invalid parameter: source"}
```
