---
title: Create Opportunity
slug: create-opportunity
docTags: 
createdAt: 2026-08-25T19:28:59.170Z
---

{
  "id": "NRk9DGgUvxZ6Lg7v3LmGS",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/cpq/opportunities",
    "servers": [
      {
        "url": "https://api.nue.io/cpq/opportunities",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/cpq/opportunities",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Create Opportunity",
    "description": "Create a new sales opportunity in Salesforce with the provided details.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "example": "{\"opportunityName\":\"Enterprise Deal - Q2\",\"closeDate\":\"2025-06-30\",\"stage\":\"Prospecting\",\"accountId\":\"001D000000IRFmaIAH\",\"description\":\"New enterprise opportunity\",\"probability\":25}",
          "description": "Opportunity details",
          "customType": "CreateOpportunityRequest",
          "schema": [
            {
              "name": "opportunityName",
              "kind": "required",
              "type": "string",
              "description": "Name of the opportunity",
              "example": "Enterprise Deal - Q2"
            },
            {
              "name": "closeDate",
              "kind": "required",
              "type": "string<date>",
              "description": "<p>Expected close date (must be in the future)</p>",
              "example": "2025-06-30",
              "format": "date"
            },
            {
              "name": "stage",
              "kind": "required",
              "type": "string",
              "description": "<p>Opportunity stage (e.g., Prospecting, Qualification, Negotiation/Review, Closed Won)</p>",
              "example": "Prospecting"
            },
            {
              "name": "accountId",
              "kind": "required",
              "type": "string",
              "description": "Salesforce account ID",
              "example": "001D000000IRFmaIAH"
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "description": "Detailed description of the opportunity"
            },
            {
              "name": "nextStep",
              "kind": "optional",
              "type": "string",
              "description": "Next steps for advancing the opportunity"
            },
            {
              "name": "probability",
              "kind": "optional",
              "type": "number",
              "description": "<p>Win probability (0-100)</p>",
              "minimum": 0,
              "maximum": 100
            }
          ],
          "modelRef": "#/components/schemas/CreateOpportunityRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "ApiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Opportunity created successfully",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Response from creating an opportunity",
            "customType": "CreateOpportunityResponse",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "description": "The Salesforce ID of the created opportunity",
                "example": "006D000000IqhSLIAZ"
              },
              {
                "name": "opportunityName",
                "kind": "optional",
                "type": "string",
                "description": "Name of the opportunity"
              },
              {
                "name": "closeDate",
                "kind": "optional",
                "type": "string<date>",
                "description": "Expected close date",
                "format": "date"
              },
              {
                "name": "stage",
                "kind": "optional",
                "type": "string",
                "description": "Opportunity stage"
              },
              {
                "name": "salesforceUrl",
                "kind": "optional",
                "type": "string",
                "description": "Direct URL to the opportunity in Salesforce"
              }
            ],
            "modelRef": "#/components/schemas/CreateOpportunityResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "<p>Bad Request - Invalid input or business validation failure</p>",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "<p>Unauthorized - Invalid or missing API key</p>",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "WJHh84eBniHC5rPufg2ym",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/cpq/opportunities \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"opportunityName\": \"Enterprise Deal - Q2\",\n     \"closeDate\": \"2025-06-30\",\n     \"stage\": \"Prospecting\",\n     \"accountId\": \"001D000000IRFmaIAH\"\n     }'"
        },
        {
          "id": "2ZV6pXeaQIzd80HQROr_b",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"opportunityName\": \"Enterprise Deal - Q2\",\n   \"closeDate\": \"2025-06-30\",\n   \"stage\": \"Prospecting\",\n   \"accountId\": \"001D000000IRFmaIAH\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/cpq/opportunities\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "WZWUYIV7dDKH_NxOsiaD0",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/cpq/opportunities\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"opportunityName\": \"Enterprise Deal - Q2\",\n   \"closeDate\": \"2025-06-30\",\n   \"stage\": \"Prospecting\",\n   \"accountId\": \"001D000000IRFmaIAH\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "w_xPHXg3MXRDm83YU6VtX",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/cpq/opportunities\"\n\npayload = json.dumps({\n   \"opportunityName\": \"Enterprise Deal - Q2\",\n   \"closeDate\": \"2025-06-30\",\n   \"stage\": \"Prospecting\",\n   \"accountId\": \"001D000000IRFmaIAH\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "WJHh84eBniHC5rPufg2ym"
    },
    "results": {
      "languages": [
        {
          "id": "EczGuQjSfgibkRyzsNW74",
          "language": "201",
          "code": "// Opportunity created successfully\n{\n  \"id\": \"006D000000IqhSLIAZ\",\n  \"opportunityName\": \"\",\n  \"closeDate\": \"\",\n  \"stage\": \"\",\n  \"salesforceUrl\": \"\"\n}"
        },
        {
          "id": "77PmyHs8ftbrXFDec2Rnj",
          "language": "400",
          "code": "// Bad Request - Invalid input or business validation failure\n"
        },
        {
          "id": "edWFsAa-KlxngxIlRbmXL",
          "language": "401",
          "code": "// Unauthorized - Invalid or missing API key\n"
        }
      ],
      "selectedLanguageId": "EczGuQjSfgibkRyzsNW74"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}