> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://zuora.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://zuora.ferndocs.com/_mcp/server.

# Create custom object definitions

POST https://rest.test.zuora.com/objects/definitions/default
Content-Type: application/json

You can post custom object definitions with the request body schema described below. 

This operation also allows you to use the [List custom object definitions](https://developer.zuora.com/api-references/api/operation/GET_AllCustomObjectDefinitionsInNamespace) response schema as its request schema. If you want to copy all the existing custom objects from an old tenant to a new tenant, you can make a [List custom object definitions](https://developer.zuora.com/api-references/api/operation/GET_AllCustomObjectDefinitionsInNamespace) call in your old tenant and then use its response directly as the request of this operation in the new tenant to import all the custom objects from the old tenant.

The `label` field is the UI label of the custom object. The `object` field contains the API Name of the custom object.

### Limitations 

This custom object definition has the following limitations:

* The maximum number of characters for the Custom Object API Name (`object`) is 64.
* The maximum number of characters for the Custom Object Label (`label`) is	64.
* The maximum number of characters for the Custom Object Description 250.
* The maximum number of custom fields in an custom object	is 50.
* The maximum number of characters for the custom field API name is	64.
* The maximum number of characters for the custom field label (`label`) is	64.
* The maximum number of characters for the custom field Description	is 250.
* The maximum number of picklist or multiselect options is 250.
* The maximum length of characters for the Text field is 255.
* The maximum length of characters for the Long Text field is from 256 to 8,192.
* The maximum number of digits to the left of the decimal point for the Number field is 13, and to the right is 9.


Reference: https://zuora.ferndocs.com/developers/api-reference/zuora-api/custom-objects/custom-object-definitions/post-custom-object-definitions

## Authentication

- `Authorization` header (bearer token, required) — Use `Bearer {{token}}` in the `Authorization` header for authentication.

## Servers

- `https://rest.test.zuora.com` (US Developer & Central Sandbox (incl. Test Drive), default)
- `https://rest.sandbox.na.zuora.com` (US API Sandbox Cloud 1)
- `https://rest.apisandbox.zuora.com` (US API Sandbox Cloud 2)
- `https://rest.na.zuora.com` (US Production Cloud 1)
- `https://rest.zuora.com` (US Production Cloud 2)
- `https://rest.test.eu.zuora.com` (EU Developer & Central Sandbox)
- `https://rest.sandbox.eu.zuora.com` (EU API Sandbox)
- `https://rest.eu.zuora.com` (EU Production)
- `https://rest.test.ap.zuora.com` (APAC Developer & Central Sandbox)
- `https://rest.ap.zuora.com` (APAC Production)

## Request

### Headers

- `Accept-Encoding` (string, optional) — Include the `Accept-Encoding: gzip` header to compress responses as a gzipped file. It can significantly reduce the bandwidth required for a response. If specified, Zuora automatically compresses responses that contain over 1000 bytes of data, and the response contains a `Content-Encoding` header with the compression algorithm so that your client can decompress it.
- `Content-Encoding` (string, optional) — Include the `Content-Encoding: gzip` header to compress a request. With this header specified, you should upload a gzipped file for the request payload instead of sending the JSON payload.
- `Zuora-Track-Id` (string, optional) — A custom identifier for tracing the API call. If you set a value for this header, Zuora returns the same value in the response headers. This header enables you to associate your system process identifiers with Zuora API calls, to assist with troubleshooting in the event of an issue. The value of this field must use the US-ASCII character set and must not include any of the following characters: colon (`:`), semicolon (`;`), double quote (`"`), and quote (`'`).
- `Zuora-Entity-Ids` (string, optional) — An entity ID. If you have [Zuora Multi-entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity) enabled and the OAuth token is valid for more than one entity, you must use this header to specify which entity to perform the operation in. If the OAuth token is only valid for a single entity, or you do not have Zuora Multi-entity enabled, you should not set this header.
- `Zuora-Org-Ids` (string, optional) — Comma separated IDs. If you have Zuora Multi-Org enabled, you can use this header to specify which orgs to perform the operation in. If you do not have Zuora Multi-Org enabled, you should not set this header. The IDs must be a sub-set of the user's accessible orgs. If you specify an org that the user does not have access to, the operation fails. This header is important in Multi-Org (MO) setups because it defines the organization context under which the API should operate—mainly used for read access or data visibility filtering. If the header is not set, the operation is performed in scope of the user's accessible orgs.
- `Zuora-Version` (date, optional) — API version that determines the response schema. The default version is used if this parameter is not included. Specify `Zuora-Version` in the request header if you expect a specific response schema.

### Body (application/json)

This endpoint expects a PostCustomObjectDefinitionsRequest.

- `definitions` (map from string to PostCustomObjectDefinitionsRequestDefinition, optional) — The custom object definitions. This object maps types to custom object definitions.

## Response

### 200

OK

- `count` (integer, optional) — The number of objects in the `definitions` object. The value of this field is the number of custom object definitions in the namespace.
- `definitions` (map from string to CustomObjectDefinition, optional) — The custom object definitions. This object maps types to custom object definitions.

## Errors

### 400 Bad Request Error

Bad request

- `processId` (string, optional) — The ID of the process that handles the operation.
- `reasons` (list of CommonResponseReasonsItems, optional) — The container of the error code and message. This field is available only if the `success` field is `false`.
- `requestId` (string, optional) — Unique identifier of the request.
- `success` (boolean, optional) — Indicates whether the call succeeded.

## Types

### PostCustomObjectDefinitionsRequestDefinition

- `label` (string, required) — A UI label for the custom object
- `object` (string, required) — The API name of the custom object
- `auditable` (list of string, optional) — The set of fields which Audit Trail tracks and records changes of. You can change auditable fields to non-auditable, and vice versa. One custom object can have a maximum of five auditable fields.
- `enableCreateRecordAuditing` (boolean, optional, default: false) — Indicates whether to audit the creation of custom object records of this custom object definition. Note that you must enable the **Custom Object Definition** audit trail setting in your Zuora tenant before auditing custom object record creation. For more information, see Manage audit trail settings.
- `enableDeleteRecordAuditing` (boolean, optional, default: false) — Indicates whether to audit the deletion of custom object records of this custom object definition. Note that you must enable the **Custom Object Definition** audit trail setting in your Zuora tenant before auditing custom object record deletion. For more information, see Manage audit trail settings.
- `filterable` (list of string, optional) — The set of fields that are allowed to be queried on. Queries on non-filterable fields will be rejected. You can not change a non-filterable field to filterable.
- `properties` (map from string to PostCustomObjectDefinitionFieldDefinitionRequest, optional)
- `relationships` (list of PostCustomObjectDefinitionsRequestDefinitionRelationshipsItems, optional) — An array of relationships with Zuora objects or other custom objects. You can add at most 2 `manyToOne` relationships when creating a custom field definition.
- `required` (list of string, optional) — The required fields of the custom object. You can change required fields to optional. However, you can only change optional fields to required on the custom objects with no records.
- `unique` (list of string, optional) — The fields with unique constraints. You can remove the unique constraint on a field. However, you can only add a unique constraint to a filterable field if the custom object contains no record. One custom object can have a maximum of five fields with unique constraints.

### CustomObjectDefinition

- `CreatedById` (string, optional) — The creator's Id
- `CreatedDate` (datetime, optional) — The creation time of the custom object definition in date-time format.
- `Id` (string, optional) — The unique Id of the custom object definition
- `UpdatedById` (string, optional) — The modifier's Id
- `UpdatedDate` (datetime, optional) — The update time of the custom object definition in date-time format.
- `schema` (CustomObjectDefinitionSchema, optional) — The schema of the custom object definition
- `type` (string, optional) — The API name of the custom object

### CommonResponseReasonsItems

- `code` (string, optional) — The error code of response.
- `message` (string, optional) — The detail information of the error response

### PostCustomObjectDefinitionFieldDefinitionRequest

- `label` (string, required) — The UI label of the custom field
- `type` (string, required) — The data type of the custom field
- `displayName` (boolean, optional) — Indicates whether to use this field as the display name of the custom object when being linked to another custom object. This field applies only to the Text custom field type: - The `type` field is `string`. - The `enum` field is not specified.
- `format` (string, optional) — The data format of the custom field
- `maxLength` (integer, optional) — The maximum length of string that can be stored in the custom field. This field applies only to the following custom field types: - Text: - The `type` field is `string`. - The `format` field is not specified or is `url`. - The `enum` field is not specified. - Long Text: - The `type` field is `string`. - The `format` field is `long-text`. - Picklist: - The `type` field is `string`. - The `enum` field is specified. - The `multiselect` field is not specified or is `false`. - Multiselect: - The `type` field is `string`. - The `enum` field is specified. - The `multiselect` field is `true`.
- `multiselect` (boolean, optional) — Indicates whether this is a multiselect custom field. This field applies only to the Picklist or Multiselect custom field types: - The `type` field is `string`. - The `maxLength` field is specified. - The `enum` field is specified.

### PostCustomObjectDefinitionsRequestDefinitionRelationshipsItems

- `fields` (map from string to string, required) — Field mappings in the form of `<this-object-field-name>`: `<other-object-field-name>`. Usually the `<other-object-field-name>` can only be the `Id` field of the related object. Two exceptions are Subscription Name and Rate Plan Charge Number as both of them are unique.
- `namespace` (string, required) — The namespace where the related object is located
- `object` (string, required) — The API name of the related object
- `cardinality` (enum, optional) — The cardinality of the relationship from this object to another object. Only the `manyToOne` cardinality can be used when creating relationships. A relationship with `oneToMany` cardinality is created implicitly when a `manyToOne` relationship is created. A custom object definition can have a maximum of 2 `manyToOne` relationships.
  - Allowed values: `manyToOne`
- `recordConstraints` (PostCustomObjectDefinitionsRequestDefinitionRelationshipsItemsRecordConstraints, optional) — Specifies contraints to apply to custom object records.

### CustomObjectDefinitionSchema

The schema of the custom object definition

- `auditable` (list of string, optional) — The set of fields which Audit Trail tracks and records changes of.
- `enableCreateRecordAuditing` (boolean, optional) — Indicates whether to audit the creation of custom object records of this custom object definition.
- `enableDeleteRecordAuditing` (boolean, optional) — Indicates whether to audit the deletion of custom object records of this custom object definition.
- `filterable` (list of string, optional) — The set of fields that are allowed to be queried on. Queries on non-filterable fields will be rejected. You can not change a non-filterable field to filterable.
- `label` (string, optional) — A label for the custom object
- `object` (string, optional) — The API name of the custom object
- `properties` (CustomObjectAllFieldsDefinition, optional) — The definitions of all the fields in the custom object definition
- `relationships` (list of CustomObjectDefinitionSchemaRelationshipsItems, optional) — An array of relationships with Zuora objects or other custom objects
- `required` (list of string, optional) — The required fields of the custom object definition. You can change required fields to optional. However, you can only change optional fields to required on the custom objects with no records.
- `type` (enum, optional) — The custom object definition type. Can only be `object` currently.
  - Allowed values: `object`
- `unique` (list of string, optional) — The fields with unique constraints.

### PostCustomObjectDefinitionsRequestDefinitionRelationshipsItemsRecordConstraints

Specifies contraints to apply to custom object records.

- `create` (PostCustomObjectDefinitionsRequestDefinitionRelationshipsItemsRecordConstraintsCreate, optional)

### CustomObjectAllFieldsDefinition

The definitions of all the fields in the custom object definition

- `CreatedById` (CustomObjectAllFieldsDefinitionCreatedById, optional) — The `CreatedById` field definition
- `CreatedDate` (CustomObjectAllFieldsDefinitionCreatedDate, optional) — The `CreatedDate` field definition
- `Id` (CustomObjectAllFieldsDefinitionId, optional) — The `Id` field definition
- `UpdatedById` (CustomObjectAllFieldsDefinitionUpdatedById, optional) — The `UpdatedById` field definition
- `UpdatedDate` (CustomObjectAllFieldsDefinitionUpdatedDate, optional) — The `UpdatedDate` field definition

### CustomObjectDefinitionSchemaRelationshipsItems

- `cardinality` (enum, optional, default: manyToOne) — The cardinality of the relationship from this object to another object. A `manyToOne` relationship means this object is the child object (the "many" side), and the referenced object (the "one" side) is the parent. A `oneToMany` relationship means this object is the parent object (the "one" side), and the referenced object (the "many" side) is the child.
  - Allowed values: `manyToOne`, `oneToMany`
- `fields` (map from string to string, optional) — Field mappings in the form of `<this-object-field-name>`: `<other-object-field-name>`.
- `namespace` (string, optional) — The namespace where the related object is located
- `object` (string, optional) — The API name of the related object
- `recordConstraints` (CustomObjectDefinitionSchemaRelationshipsItemsRecordConstraints, optional) — Specifies contraints to apply to custom object records.

### PostCustomObjectDefinitionsRequestDefinitionRelationshipsItemsRecordConstraintsCreate

- `enforceValidMapping` (boolean, optional, default: true) — Specifies whether Zuora validates the values of mapped fields in custom object records. By default, Zuora validates the values of mapped fields in custom object records. For example, if the custom object definition has a field called `AccountId__c` that is mapped to the `Id` field of the `account` object, Zuora verifies that the value of `AccountId__c` is a valid account ID when a custom object record is created. If the value of `AccountId__c` is not a valid account ID, the operation fails.

### CustomObjectAllFieldsDefinitionCreatedById

The `CreatedById` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `uuid`
- `label` (string, optional) — The UI name of the field
- `origin` (enum, optional) — Specifies whether the field is a system field or a custom field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectAllFieldsDefinitionCreatedDate

The `CreatedDate` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `date-time`
- `origin` (enum, optional) — Specifies the field is a system field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectAllFieldsDefinitionId

The `Id` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `uuid`
- `label` (string, optional) — The UI name of the field
- `origin` (enum, optional) — Specifies whether the field is a system field or a custom field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectAllFieldsDefinitionUpdatedById

The `UpdatedById` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `uuid`
- `label` (string, optional) — The UI name of the field
- `origin` (enum, optional) — Specifies whether the field is a system field or a custom field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectAllFieldsDefinitionUpdatedDate

The `UpdatedDate` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `date-time`
- `origin` (enum, optional) — Specifies the field is a system field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectDefinitionSchemaRelationshipsItemsRecordConstraints

Specifies contraints to apply to custom object records.

- `create` (CustomObjectDefinitionSchemaRelationshipsItemsRecordConstraintsCreate, optional)

### CustomObjectDefinitionSchemaRelationshipsItemsRecordConstraintsCreate

- `enforceValidMapping` (boolean, optional) — Specifies whether Zuora validates the values of mapped fields in custom object records.

## Examples

**Request**

```json
{
  "definitions": {
    "Vehicle": {
      "label": "Vehicle",
      "object": "Vehicle",
      "properties": {
        "DeviceId__c": {
          "label": "Device ID",
          "type": "string",
          "maxLength": 20
        },
        "OrderId__c": {
          "label": "Order ID",
          "type": "string",
          "format": "uuid"
        }
      },
      "relationships": [
        {
          "fields": {
            "OrderId__c": "Id"
          },
          "namespace": "com_zuora",
          "object": "orders"
        }
      ]
    }
  }
}
```

**Response**

```json
{
  "CreatedById": "8ad084a67f9c7138017fab8a8b511b5a",
  "CreatedDate": "2024-11-15T06:13:27.338Z",
  "Id": "f67635c8-094e-4ffc-90be-5dba5c639494",
  "UpdatedById": "8ad084a67f9c7138017fab8a8b511b5a",
  "UpdatedDate": "2024-11-15T06:13:27.338Z",
  "schema": {
    "enableCreateRecordAuditing": false,
    "enableDeleteRecordAuditing": false,
    "enableRecordMigration": false,
    "filterable": [
      "OrderId__c",
      "Id",
      "CreatedDate",
      "UpdatedDate"
    ],
    "label": "Vehicle",
    "object": "Vehicle",
    "properties": {
      "CreatedById": {
        "label": "CreatedById",
        "origin": "system",
        "type": "string"
      },
      "CreatedDate": {
        "format": "date-time",
        "label": "CreatedDate",
        "origin": "system",
        "type": "string"
      },
      "DeviceId__c": {
        "label": "Device ID",
        "maxLength": 20,
        "origin": "custom",
        "type": "string"
      },
      "Id": {
        "format": "uuid",
        "label": "Id",
        "origin": "system",
        "type": "string"
      },
      "OrderId__c": {
        "format": "uuid",
        "label": "Order ID",
        "origin": "custom",
        "type": "string"
      },
      "UpdatedById": {
        "label": "UpdatedById",
        "origin": "system",
        "type": "string"
      },
      "UpdatedDate": {
        "format": "date-time",
        "label": "UpdatedDate",
        "origin": "system",
        "type": "string"
      }
    },
    "relationships": [
      {
        "cardinality": "manyToOne",
        "fields": {
          "OrderId__c": "Id"
        },
        "namespace": "com_zuora",
        "object": "orders",
        "recordConstraints": {
          "create": {
            "enforceValidMapping": true
          }
        }
      },
      {
        "cardinality": "manyToOne",
        "fields": {
          "CreatedById": "Id"
        },
        "namespace": "com_zuora",
        "object": "User",
        "recordConstraints": {
          "create": {
            "enforceValidMapping": true
          }
        }
      },
      {
        "cardinality": "manyToOne",
        "fields": {
          "UpdatedById": "Id"
        },
        "namespace": "com_zuora",
        "object": "User",
        "recordConstraints": {
          "create": {
            "enforceValidMapping": true
          }
        }
      }
    ],
    "required": [
      "Id",
      "CreatedById",
      "UpdatedById",
      "CreatedDate",
      "UpdatedDate"
    ]
  },
  "type": "Vehicle"
}
```

**SDK Code**

```python
import requests

url = "https://rest.test.zuora.com/objects/definitions/default"

payload = { "definitions": { "Vehicle": {
            "label": "Vehicle",
            "object": "Vehicle",
            "properties": {
                "DeviceId__c": {
                    "label": "Device ID",
                    "type": "string",
                    "maxLength": 20
                },
                "OrderId__c": {
                    "label": "Order ID",
                    "type": "string",
                    "format": "uuid"
                }
            },
            "relationships": [
                {
                    "fields": { "OrderId__c": "Id" },
                    "namespace": "com_zuora",
                    "object": "orders"
                }
            ]
        } } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://rest.test.zuora.com/objects/definitions/default';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"definitions":{"Vehicle":{"label":"Vehicle","object":"Vehicle","properties":{"DeviceId__c":{"label":"Device ID","type":"string","maxLength":20},"OrderId__c":{"label":"Order ID","type":"string","format":"uuid"}},"relationships":[{"fields":{"OrderId__c":"Id"},"namespace":"com_zuora","object":"orders"}]}}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://rest.test.zuora.com/objects/definitions/default"

	payload := strings.NewReader("{\n  \"definitions\": {\n    \"Vehicle\": {\n      \"label\": \"Vehicle\",\n      \"object\": \"Vehicle\",\n      \"properties\": {\n        \"DeviceId__c\": {\n          \"label\": \"Device ID\",\n          \"type\": \"string\",\n          \"maxLength\": 20\n        },\n        \"OrderId__c\": {\n          \"label\": \"Order ID\",\n          \"type\": \"string\",\n          \"format\": \"uuid\"\n        }\n      },\n      \"relationships\": [\n        {\n          \"fields\": {\n            \"OrderId__c\": \"Id\"\n          },\n          \"namespace\": \"com_zuora\",\n          \"object\": \"orders\"\n        }\n      ]\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://rest.test.zuora.com/objects/definitions/default")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"definitions\": {\n    \"Vehicle\": {\n      \"label\": \"Vehicle\",\n      \"object\": \"Vehicle\",\n      \"properties\": {\n        \"DeviceId__c\": {\n          \"label\": \"Device ID\",\n          \"type\": \"string\",\n          \"maxLength\": 20\n        },\n        \"OrderId__c\": {\n          \"label\": \"Order ID\",\n          \"type\": \"string\",\n          \"format\": \"uuid\"\n        }\n      },\n      \"relationships\": [\n        {\n          \"fields\": {\n            \"OrderId__c\": \"Id\"\n          },\n          \"namespace\": \"com_zuora\",\n          \"object\": \"orders\"\n        }\n      ]\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://rest.test.zuora.com/objects/definitions/default")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"definitions\": {\n    \"Vehicle\": {\n      \"label\": \"Vehicle\",\n      \"object\": \"Vehicle\",\n      \"properties\": {\n        \"DeviceId__c\": {\n          \"label\": \"Device ID\",\n          \"type\": \"string\",\n          \"maxLength\": 20\n        },\n        \"OrderId__c\": {\n          \"label\": \"Order ID\",\n          \"type\": \"string\",\n          \"format\": \"uuid\"\n        }\n      },\n      \"relationships\": [\n        {\n          \"fields\": {\n            \"OrderId__c\": \"Id\"\n          },\n          \"namespace\": \"com_zuora\",\n          \"object\": \"orders\"\n        }\n      ]\n    }\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://rest.test.zuora.com/objects/definitions/default', [
  'body' => '{
  "definitions": {
    "Vehicle": {
      "label": "Vehicle",
      "object": "Vehicle",
      "properties": {
        "DeviceId__c": {
          "label": "Device ID",
          "type": "string",
          "maxLength": 20
        },
        "OrderId__c": {
          "label": "Order ID",
          "type": "string",
          "format": "uuid"
        }
      },
      "relationships": [
        {
          "fields": {
            "OrderId__c": "Id"
          },
          "namespace": "com_zuora",
          "object": "orders"
        }
      ]
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://rest.test.zuora.com/objects/definitions/default");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"definitions\": {\n    \"Vehicle\": {\n      \"label\": \"Vehicle\",\n      \"object\": \"Vehicle\",\n      \"properties\": {\n        \"DeviceId__c\": {\n          \"label\": \"Device ID\",\n          \"type\": \"string\",\n          \"maxLength\": 20\n        },\n        \"OrderId__c\": {\n          \"label\": \"Order ID\",\n          \"type\": \"string\",\n          \"format\": \"uuid\"\n        }\n      },\n      \"relationships\": [\n        {\n          \"fields\": {\n            \"OrderId__c\": \"Id\"\n          },\n          \"namespace\": \"com_zuora\",\n          \"object\": \"orders\"\n        }\n      ]\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["definitions": ["Vehicle": [
      "label": "Vehicle",
      "object": "Vehicle",
      "properties": [
        "DeviceId__c": [
          "label": "Device ID",
          "type": "string",
          "maxLength": 20
        ],
        "OrderId__c": [
          "label": "Order ID",
          "type": "string",
          "format": "uuid"
        ]
      ],
      "relationships": [
        [
          "fields": ["OrderId__c": "Id"],
          "namespace": "com_zuora",
          "object": "orders"
        ]
      ]
    ]]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://rest.test.zuora.com/objects/definitions/default")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```