**Source URL:** https://limited.veevavault.dev/qualityone/vault-api/api-reference/23.1/vault-objects/create-object-records.md

# Create Object Records



Create Vault object records in bulk.

You can use this endpoint to create User Tasks or User (`user__sys`) records. Learn more about [User Tasks](https://platform.veevavault.help/en/lr/40757) and the [User & Person Objects](https://platform.veevavault.help/en/lr/46534) in Vault Help.

* The maximum input file size is 10 MB.

* The values in the input must be UTF-8 encoded.

* CSVs must follow the standard RFC 4180 format, with some [exceptions](/vault-api/references/csv-rfc-deviations).

* The maximum batch size is 500.

You can only add [relationships on object fields](/vault-api/api-reference/23.1/vault-objects/update-object-records) using ID values or based on a unique field on the target object. This API does not support [object lookup fields](https://developer.veevavault.com/vql/#Object_Lookup_Fields).

<Endpoint path="/api/{version}/vobjects/{object_name}" method="POST"></Endpoint>

## Headers {#headers}

<FieldTable>
| Name | Description |
| --- | --- |
| `Content-Type` | `text/csv` or `application/json` |
| `Accept` | `application/json` (default) or `text/csv` |
| `X-VaultAPI-MigrationMode` | If set to `true`, Vault bypasses entry criteria, entry actions, validation rules, and reference constraints when creating object records and allows you to create records in a specific state or state type. If a valid state or state type is not specified, records will be created in their initial state. You must have the *Record Migration* permission to use this header. |
</FieldTable>

## URI Path Parameters {#uri-path-parameters}

<FieldTable>
| Name | Description |
| --- | --- |
| `{object_name}` | The name of the object, for example, `product__v`. |
</FieldTable>

## Body Parameters {#body-parameters}

Upload parameters as a JSON or CSV file.

<FieldTable>
| Name | Description |
| --- | --- |
| `name__v` | This field is required unless it is set to system-managed. To find out if an object uses system-managed naming, retrieve its `name__v` field and look for the `system_managed_name` property set to `true` or `false`. Learn more about system-managed naming in [Vault Help](https://platform.veevavault.help/en/lr/30986). |
| `object_type__v` | To create objects of a specific object type, add this field with the `id` of the object type. Requests may include either `object_type__v` or `object_type__v.api_name__v`, but not both. |
| `object_type__v.api_name__v` | To create objects of a specific object type, add this field with the `name` of the object type. Requests may include either `object_type__v` or `object_type__v.api_name__v`, but not both. |
| `source_record_id` | To copy an existing object record, add this field with the `id` of the existing object record. Any values specified for other fields will override the copied values. To perform a deep (hierarchical) copy of a record, see the [Deep Copy](/vault-api/api-reference/23.1/vault-objects/deep-copy-object-record) endpoint. |
| `state__v` | Specifies the lifecycle state of the record when `X-VaultAPI-MigrationMode` is set to `true`. For example, `draft_state__c`. |
| `state_label` | Specifies the lifecycle state type of the record when `X-VaultAPI-MigrationMode` is set to `true`. Use the format `base:object_lifecycle:` followed by the object state type. For example, `base:object_lifecycle:initial_state_type`. When providing both a state and state type, the `state_label` value must map to the provided `state__v` value. For example, if the `state__v` value is set to `draft_state__c`, the `state_label` value must already be set to draft in the destination Vault. |
</FieldTable>

## Add Relationships on Object Fields {#add-relationships-on-object-fields}

Many object records have relationships with other object records. For example, the object record details for the *Marketing Campaign* "CholeCap Campaign" references its parent "CholeCap" *Product* record. When creating or upserting object records, there are instances where an object field in your input file indicates an object relationship. The API supports the use of reference relationships and parent-child relationships within fields, but not lookup fields. To refer to object relationships in an object field, set the column header in the input file to be a combination of the relationship name and a unique object field, such as `name__v`. For example, `product__vr.name__v` references the name of the related *Product* record.

## Upsert Object Records {#upsert-object-records}

Upsert is a combination of create and update. With `idParam`, you can identify an object record by any unique object field.
This allows you to use one input file to create new object records and update existing records at the same time.
If a matching record exists, Vault updates the record with the unique field values specified in the input.
If no matching object record exists, Vault creates a new record using the values in the input.

Upsert expects unique `idParam` field values in the request and providing duplicate values will result in a `FAILURE` for the entire batch.

To upsert records in a specific state or state type, use the [Migration Mode](#X-VaultAPI-MigrationMode_header) header.

##### Query String Parameters {#query-string-parameters}

<FieldTable>
| Name | Description |
| --- | --- |
| `idParam` | To upsert object records, add `idParam={field_name}` to the request endpoint. For example, `idParam=external_id__v`. You can use any object field which has `unique` set to `true` in the object metadata. For example, `idParam=external_id__v`. |
</FieldTable>
<DownloadButton href="/sample-files/bulk-create-object-records.json" label="Download Input File"></DownloadButton>
Admin may set other standard or custom object fields to required. Use the Object Metadata API to retrieve all fields configured on objects. You can add any object field with `editable: true`.

## Create User Object Records {#create-user-object-records}

To create `user__sys` records, your input file must have all required fields on `user__sys`. You can choose to create new users in pending state and defer welcome emails by setting `activation_date__sys` to a future date.

Use the [Retrieve Object Metadata](/vault-api/api-reference/23.1/vault-objects/retrieve-object-metadata) endpoint on `user__sys` to retrieve a full list of fields.

This API does not support the following:

* Creating cross-domain users. To create cross-domain users, use the [Create Single User](/vault-api/api-reference/23.1/users/create-users/create-single-user) endpoint.

* Adding users to a domain without assigning them to a Vault. To add users to a domain only, use the [Create Single User](/vault-api/api-reference/23.1/users/create-users/create-single-user) endpoint.

* Changing user passwords.

##### Body Parameters {#body-parameters-1}

The following fields are required in your input file to create `user__sys` records:

<FieldTable>
| Name | Description |
| --- | --- |
| `email__sys` | The user’s email address. For example, `ewoodhouse@email.com` An email address is required to prevent adding duplicate users in error. For example, users John and Jane Smith may both use “jsmith” as a user name. An email address ensures adding the correct user. |
| `first_name__sys` | The user's first name. |
| `last_name__sys` | The user's last name. |
| `username__sys` | The user’s Vault user name (login credential). `username__sys` is a multi-part field. To set the user name, provide the entire value. For example, `ewoodhouse@veepharm.com`. |
| `language__sys` | The user's preferred language. |
| `locale__sys` | The user's location. |
| `timezone__sys` | The user's time zone. |
| `license_type__sys` | The user’s license type. If omitted, default value is `full__v`. |
| `security_profile__sys` | The user’s security profile. |
| `status__v` | The status of the user. |
| `source_person_id__v` | The person record to be associated with this user. This field is only available in Clinical Operations Vaults. See [Managing the Person & Organization Objects](https://clinical.veevavault.help/en/lr/31637) for more information. |
| `activation_date__sys` | The date the user will first be able to access Vault in `YYYY-MM-DD` format. If excluded, defaults to today’s date. |
| `send_welcome_email__sys` | Set to `true` to defer welcome email until user’s account activation date. Set to `false` to send no welcome email. |
</FieldTable>
<DownloadButton href="/sample-files/vault-create-object-records-sample-csv-input.csv" label="Download Input File"></DownloadButton>
<DownloadButton href="/sample-files/bulk-create-user-objects.json" label="Download Input File"></DownloadButton>
Note that when you create, add, or update `user__sys`, Vault synchronizes those changes with `users` across all Vaults to which that user is a member. This includes cross-domain Vaults.

## Request {#request}

<CodeExample title="">
```
curl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: text/csv" \
-H "Accept: text/csv" \
--data-binary @"C:\Vault\Object Records\create_object_records.csv" \
https://myvault.veevavault.com/api/v8.0/vobjects/product__v

```
</CodeExample>

## Response {#response}

<CodeExample title="">
```
{
    "responseStatus": "SUCCESS",
    "data": [
        {
            "responseStatus": "SUCCESS",
            "data": {
                "id": "0PR0771",
                "url": "api/v8.0/vobjects/product__v/0PR0771"
            }
        },
        {
            "responseStatus": "SUCCESS",
            "data": {
                "id": "0PR0772",
                "url": "api/v8.0/vobjects/product__v/0PR0772"
            }
        },
        {
            "responseStatus": "SUCCESS",
            "data": {
                "id": "0PR0773",
                "url": "api/v8.0/vobjects/product__v/0PR0773"
            }
        },
        {
            "responseStatus": "FAILURE",
            "errors": [
                {
                    "type": "INVALID_DATA",
                    "message": "Error message describing why this object record was not created."
                }
            ]
        }
    ]
}

```
</CodeExample>

## Response Details {#response-details}

On SUCCESS, Vault returns the `id` and `url` of each new record.

Note that if an object has a field default configured, the value you use for that field overrides the default.

Note that in CTMS Vaults, if you do not specify a milestone record ID when creating a new *Monitoring Event* record, this call will automatically create a new *Milestone* record. However, the `id` of the new *Milestone* record is not returned in this response. Learn more about automated CTMS object creation in [Vault Help](https://clinical.veevavault.help/en/lr/40009).



---

**Previous:** [Retrieve Object Record](/qualityone/vault-api/api-reference/23.1/vault-objects/retrieve-object-record)  
**Next:** [Update Object Records](/qualityone/vault-api/api-reference/23.1/vault-objects/update-object-records)