---
title: Create Objects
slug: create-objects
createdAt: 2026-03-17T21:13:53.446Z
---

The Create Objects API allows you to create object records directly in Salesforce through Nue's Revenue Lifecycle API. This endpoint provides a generic, metadata-driven interface for creating records.

:::hint{type="info"}
**Required Permission**

Your API key must be associated with a role that has **Manage Salesforce Orders** and/or **Manage Quotes** permission enabled under the "Nue on Salesforce" category.
:::

## Endpoint

```javascript
POST /api/objects/{objectName}
```

## Supported Objects

| Object          | Endpoint                          | Description                                                                                                                                                             |
| --------------- | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Customer`      | `POST /api/objects/Customer`      | Create customer accounts (maps to Salesforce Account)                                                                                                                   |
| `Opportunity`   | `POST /cpq/opportunities`         | Create sales opportunities                                                                                                                                              |
| `LineAttribute` | `POST /api/objects/LineAttribute` | Create a Line Attribute definition. See [Line Attributes](<Guides and Examples/Customer Lifecycle/CPQ Revenue Lifecycle/Line Attributes/Line Attributes Overview.mdx>). |

:::hint{type="info"}
**Important: Metadata-Driven Fields**
The fields available are determined by your Salesforce metadata configuration. The fields documented below are **common examples** and may vary based on your organization's setup. To see the exact fields available for your environment:

- Use the [Metadata API](/docs/api-references/metadata-api) to retrieve object definitions
- Check your Salesforce org's field configurations
- Custom fields added to your Salesforce objects will also be available

Configuration objects (for example `LineAttribute`) are addressed by their **Nue object apiName**, not the Salesforce `__c` API name, and their fields use **Nue camelCase apiNames**. Always confirm the exact object and field names with the Metadata API (`GET /api/metadata/objects/{objectName}`) before writing a payload.
:::

## Authentication

Include your API key in the request header:

```bash
curl -X POST 'https://api.nue.io/api/objects/Customer' \
  -H 'nue-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json'
```

## Request

Create a new customer account in your Salesforce org.

```bash
curl -X POST 'https://api.nue.io/api/objects/Customer' \
  -H 'nue-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Acme Corporation",
    "recordType": "Business"
  }'
```

## Customer Fields (Examples)

The following fields are commonly available. Your actual fields depend on your metadata configuration.

| Field                | Type   | Required | Description                                          |
| -------------------- | ------ | -------- | ---------------------------------------------------- |
| `name`               | string | Yes      | Account name                                         |
| `recordType`         | string | No       | Account record type (e.g., "Business", "Individual") |
| `accountNumber`      | string | No       | Account number                                       |
| `email`              | string | No       | Primary contact email                                |
| `phone`              | string | No       | Phone number                                         |
| `industry`           | string | No       | Industry classification                              |
| `billingStreet`      | string | No       | Billing street address                               |
| `billingCity`        | string | No       | Billing city                                         |
| `billingState`       | string | No       | Billing state/province                               |
| `billingPostalCode`  | string | No       | Billing postal code                                  |
| `billingCountry`     | string | No       | Billing country                                      |
| `shippingStreet`     | string | No       | Shipping street address                              |
| `shippingCity`       | string | No       | Shipping city                                        |
| `shippingState`      | string | No       | Shipping state/province                              |
| `shippingPostalCode` | string | No       | Shipping postal code                                 |
| `shippingCountry`    | string | No       | Shipping country                                     |
| `billCycleDay`       | string | No       | Day of month for billing cycle                       |
| `paymentTerm`        | string | No       | Payment terms (e.g., "NET30")                        |
| `paymentMethod`      | string | No       | Default payment method                               |
| `description`        | string | No       | Account description                                  |

## Response

```json
{
  "id": "001D000000IRFmaIAH"
}
```

## Create Opportunity

Create a new sales opportunity in Salesforce.

### Endpoint

```javascript
POST /cpq/opportunities
```

### Request

```bash
curl -X POST 'https://api.nue.io/cpq/opportunities' \
  -H 'nue-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "opportunityName": "Enterprise Deal - Q2",
    "closeDate": "2025-06-30",
    "stage": "Prospecting",
    "accountId": "001D000000IRFmaIAH",
    "description": "New enterprise opportunity",
    "probability": 25
  }'
```

### Opportunity Fields

| Field             | Type   | Required | Description                                                                                  |
| ----------------- | ------ | -------- | -------------------------------------------------------------------------------------------- |
| `opportunityName` | string | Yes      | Name of the opportunity                                                                      |
| `closeDate`       | date   | Yes      | Expected close date (must be in the future)                                                  |
| `stage`           | string | Yes      | Opportunity stage (e.g., "Prospecting", "Qualification", "Negotiation/Review", "Closed Won") |
| `accountId`       | string | Yes      | Salesforce account ID                                                                        |
| `description`     | string | No       | Detailed description of the opportunity                                                      |
| `nextStep`        | string | No       | Next steps for advancing the opportunity                                                     |
| `probability`     | number | No       | Win probability (0-100)                                                                      |

### Response

```json
{
  "id": "006D000000IqhSLIAZ",
  "opportunityName": "Enterprise Deal - Q2",
  "closeDate": "2025-06-30",
  "stage": "Prospecting",
  "salesforceUrl": "https://your-org.salesforce.com/lightning/r/Opportunity/006D000000IqhSLIAZ/view"
}
```

## Error Handling

### Common Error Responses

| Status Code | Error        | Description                                       |
| ----------- | ------------ | ------------------------------------------------- |
| 400         | Bad Request  | Invalid request format or missing required fields |
| 401         | Unauthorized | Invalid or missing API key                        |
| 403         | Forbidden    | Insufficient permissions                          |
| 404         | Not Found    | Object type not found in metadata                 |
| 409         | Conflict     | Record already exists or constraint violation     |

### Example Error Response

```json
{
  "code": 400,
  "message": "Bad Request",
  "details": "Required field 'name' is missing"
}
```
