> 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"}
```


---

# 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://docs.fieldmotion.com/fieldmotion-api-docs/opportunity/_new.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.
