> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Create opportunity

> Create a Close opportunity.

`close.createOpportunity` creates a Close opportunity.

```ts automations/close-create-opportunity.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { close } from "automate.ax/close"

export default automation("Create opportunity", () => {
  onDashboardRun({ title: "Create opportunity" })
  close.createOpportunity({
    leadId: "lead_abc123",
    statusId: "stat_active",
    value: 50000,
    valuePeriod: "annual",
    confidence: 75,
  })
})
```

## Inputs

Set `leadId` to add the opportunity to an existing lead. If you omit it, Close creates an Untitled lead. `pipelineId` selects a pipeline and `statusId` selects one of its statuses. You can also set attachments, contact, owner, notes, custom fields, dates, value, value period, and 0–100 confidence. Optional second argument `{ account }` selects a named Close binding.

## Output

Returns the created `CloseOpportunity`.
