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

# Close CRM: Close Create Opportunity

> Create a sales opportunity or deal in Close CRM with a company lead, pipeline stage, owner and amount. Includes SDK V2 examples, schemas, and cost.

Create a sales opportunity or deal in Close CRM with a company lead, pipeline stage, owner and amount.

> [!NOTE]
>
> Tool ID: `close_create_opportunity`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'close_create_opportunity',
  {
    "attachments": null,
    "confidence": null,
    "contact_id": null
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline run close_create_opportunity --input '{
  "attachments": null,
  "confidence": null,
  "contact_id": null
}'
```

## Example response

The SDK returns this shape at `result.toolResponse.raw`. The example values illustrate the response.

```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
{
  "data": {
    "annualized_expected_value": 1,
    "annualized_value": 1,
    "attachments": [
      {
        "content_type": "example",
        "filename": "example",
        "size": 1,
        "url": "https://example.com"
      }
    ]
  }
}
```

Use `deepline describe close_create_opportunity --json` for the latest machine-readable contract.

## Input reference

Create a Close CRM opportunity (sales deal). Supply lead\_id to attach it to an existing company. omitting it also creates an Untitled lead. Monetary value is in cents in the organization currency. This creates CRM records and can create duplicates if repeated. Use a stable Deepline execution key to recover an uncertain outcome before starting another write.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.attachments` | `array` | No | — | — |
| `payload.confidence` | `integer` | No | — | — |
| `payload.contact_id` | `string` | No | — | — |
| `payload.created_by` | `string` | No | — | — |
| `payload.date_created` | `string` | No | — | — |
| `payload.date_won` | `string` | No | — | If not set on the resource or in the request, `date_won` will be set automatically to today's date when setting `status_id` to a status with type `won`. The `x-tz-offset` header, used to pass your timezone's UTC offset, will be taken into account. |
| `payload.lead_id` | `string` | No | — | Opportunities belong to exactly one Lead. If not provided, a new lead will be created (appearing as "Untitled" in the UI). |
| `payload.note` | `string` | No | — | Plaintext/markdown version of the note. If `note_html` is also provided in the same request, this value is ignored and `note` is derived from the HTML instead. |
| `payload.note_html` | `string` | No | — | Rich-text HTML version of the note. When set, `note` is automatically populated with the plaintext version (tags become markdown), overriding any `note` value passed in the same request. |
| `payload.pipeline_id` | `string` | No | — | Specify which pipeline this opportunity should belong to. When supplied without `status_id`, the opportunity will be created with the first available status of that pipeline. When supplied with `status_id`, the status must belong to the specified pipeline or a 400 error will be returned. If the pipeline does not exist, a 400 error will be returned. See the [Pipelines API](https://developer.close.com/api/resources/pipelines). |
| `payload.status_id` | `string` | No | — | Post a `status_id` to create an opportunity with a specific status. If omitted, the organization's default (first) status will be used (or the first status of the `pipeline_id` if provided). See the [Opportunity Status API](https://developer.close.com/api/resources/opportunity-statuses). |
| `payload.user_id` | `string` | No | — | — |
| `payload.value` | `integer` | No | — | Monetary value of the opportunity in cents, e.g. `340000` for \$3,400.00. The currency is the organization's currency. |
| `payload.value_period` | `"one_time" \| "monthly" \| "annual"` | No | — | — |
| `payload.custom_fields` | `record` | No | — | Map Close custom field ids (cf\_...) to values. null clears a value. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Create a Close CRM opportunity (sales deal). Supply lead_id to attach it to an existing company; omitting it also creates an Untitled lead. Monetary value is in cents in the organization currency. This creates CRM records and can create duplicates if repeated. Use a stable Deepline execution key to recover an uncertain outcome before starting another write.",
    "properties": {
      "attachments": {
        "default": null,
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "filename",
                "url"
              ],
              "properties": {
                "content_type": {
                  "type": "string",
                  "default": ""
                },
                "filename": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          },
          {
            "type": "null"
          }
        ]
      },
      "confidence": {
        "default": null,
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "contact_id": {
        "default": null,
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_by": {
        "default": null,
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "date_created": {
        "default": null,
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "date_won": {
        "description": "If not set on the resource or in the request, `date_won` will be set automatically to today's date when setting `status_id` to a status with type `won`. The `x-tz-offset` header, used to pass your timezone's UTC offset, will be taken into account.",
        "default": null,
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "lead_id": {
        "description": "Opportunities belong to exactly one Lead. If not provided, a new lead will be created (appearing as \"Untitled\" in the UI).",
        "default": null,
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "note": {
        "description": "Plaintext/markdown version of the note. If `note_html` is also provided in the same request, this value is ignored and `note` is derived from the HTML instead.",
        "default": null,
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "note_html": {
        "description": "Rich-text HTML version of the note. When set, `note` is automatically populated with the plaintext version (tags become markdown), overriding any `note` value passed in the same request.",
        "default": null,
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "pipeline_id": {
        "description": "Specify which pipeline this opportunity should belong to. When supplied without `status_id`, the opportunity will be created with the first available status of that pipeline. When supplied with `status_id`, the status must belong to the specified pipeline or a 400 error will be returned. If the pipeline does not exist, a 400 error will be returned. See the [Pipelines API](https://developer.close.com/api/resources/pipelines).",
        "default": null,
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "status_id": {
        "description": "Post a `status_id` to create an opportunity with a specific status. If omitted, the organization's default (first) status will be used (or the first status of the `pipeline_id` if provided). See the [Opportunity Status API](https://developer.close.com/api/resources/opportunity-statuses).",
        "default": null,
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "user_id": {
        "default": null,
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "value": {
        "description": "Monetary value of the opportunity in cents, e.g. `340000` for $3,400.00. The currency is the organization's currency.",
        "default": null,
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "value_period": {
        "default": null,
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "one_time",
              "monthly",
              "annual"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "custom_fields": {
        "type": "object",
        "description": "Map Close custom field ids (cf_...) to values; null clears a value.",
        "propertyNames": {
          "pattern": "^cf_[A-Za-z0-9]+$"
        },
        "additionalProperties": {
          "not": {
            "type": "object"
          }
        }
      }
    },
    "required": [],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | Provider response payload. |
| `result.data.annualized_expected_value` | `integer \| null` | No | — | Annualized expected value in cents. |
| `result.data.annualized_value` | `integer \| null` | No | — | Annualized value in cents. |
| `result.data.attachments` | `array` | No | — | — |
| `result.data.attachments[].content_type` | `string \| null` | Yes | — | — |
| `result.data.attachments[].filename` | `string \| null` | Yes | — | — |
| `result.data.attachments[].size` | `integer \| null` | Yes | — | — |
| `result.data.attachments[].thumbnail_url` | `string \| null` | No | — | — |
| `result.data.attachments[].url` | `string` | Yes | — | — |
| `result.data.comment_summary` | `object \| null` | No | — | — |
| `result.data.comment_summary.comment_count` | `integer` | Yes | — | — |
| `result.data.comment_summary.thread_id` | `string` | Yes | — | — |
| `result.data.confidence` | `integer` | No | — | — |
| `result.data.contact_id` | `string \| null` | No | — | — |
| `result.data.contact_name` | `string \| null` | No | — | — |
| `result.data.created_by` | `string \| null` | No | — | — |
| `result.data.created_by_name` | `string \| null` | No | — | — |
| `result.data.date_created` | `string` | No | — | Format: `date-time`. |
| `result.data.date_lost` | `string \| null` | No | — | Format: `date-time`. |
| `result.data.date_updated` | `string` | No | — | Format: `date-time`. |
| `result.data.date_won` | `string \| null` | No | — | Format: `date`. |
| `result.data.expected_value` | `integer \| null` | No | — | Value multiplied by confidence, in cents. |
| `result.data.id` | `string` | No | — | — |
| `result.data.integration_links` | `array` | No | — | — |
| `result.data.integration_links[].name` | `string` | Yes | — | — |
| `result.data.integration_links[].url` | `string` | Yes | — | — |
| `result.data.is_stalled` | `boolean` | No | — | — |
| `result.data.lead_id` | `string` | No | — | — |
| `result.data.lead_name` | `string \| null` | No | — | — |
| `result.data.lead_primary_email` | `object \| null` | No | — | — |
| `result.data.lead_primary_email.email` | `string` | Yes | — | — |
| `result.data.lead_primary_email.is_unsubscribed` | `boolean` | Yes | — | — |
| `result.data.lead_primary_email.type` | `string` | Yes | — | — |
| `result.data.lead_primary_phone` | `array \| null` | No | — | — |
| `result.data.lead_primary_phone[].country` | `string \| null` | No | — | — |
| `result.data.lead_primary_phone[].outbound_sms_blocked` | `boolean` | No | — | — |
| `result.data.lead_primary_phone[].phone` | `string` | Yes | — | — |
| `result.data.lead_primary_phone[].phone_formatted` | `string` | No | — | — |
| `result.data.lead_primary_phone[].type` | `string` | Yes | — | — |
| `result.data.lead_primary_phone[].tz_ids` | `array` | No | — | — |
| `result.data.note` | `string \| null` | No | — | — |
| `result.data.note_html` | `string \| null` | No | — | — |
| `result.data.organization_id` | `string` | No | — | — |
| `result.data.pipeline_id` | `string \| null` | No | — | — |
| `result.data.pipeline_name` | `string \| null` | No | — | — |
| `result.data.stall_status` | `object \| null` | No | — | — |
| `result.data.stall_status.communication_issue` | `"no_issue" \| "cant_get_in_touch" \| "no_communication_attempts"` | Yes | — | Allowed: `no_issue`, `cant_get_in_touch`, `no_communication_attempts`. |
| `result.data.stall_status.next_action` | `object` | Yes | — | — |
| `result.data.stall_status.next_action.action` | `"mark_as_lost" \| "change_status" \| "follow_up" \| "adjust_close_date" \| "ask_someone_else_to_reach_out" \| "change_communication_method"` | Yes | — | Allowed: `mark_as_lost`, `change_status`, `follow_up`, `adjust_close_date`, `ask_someone_else_to_reach_out`, `change_communication_method`. |
| `result.data.stall_status.next_action.justification` | `string` | Yes | — | A short justification for the recommended action in the sales pipeline. Maximum 2 sentences. |

The table shows the first 50 fields. Expand the raw schema below for every field.

> [!NOTE]
>
> This output schema is too large for an inline display. Read the complete live contract with `deepline describe close_create_opportunity --json`.

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Connect integrations](https://deepline.com/docs/integrations.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.